Skip to content

Elysia suffers from dual package hazard #1143

@matthewlilley

Description

@matthewlilley

What version of Elysia is running?

latest

What platform is your computer?

Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Create an Elysia project with "type": "module" in the package.json

Elysia modules are imported as CJS, so then when you use a package like TypeBox which doesn't suffer from the dual package hazard, it will import the ESM versions of the code which are incompatible with Elysia exported TypeBox modules.

The workaround for now is to patch TypeBox so that it only exports CJS which isn't preferable, but has to be done to use TypeBox alongside Elysia in an ESM based project.

What is the expected behavior?

If the project using Elysia has a "type": "module" specified, it should use ESM code from Elysia, which would mean that TypeBox can be used as expected.

What do you see instead?

No response

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreviewWaiting for issue reporter approval

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions