Closed BLucky-gh closed 2 months ago
Elysia now exports esm and cjs separately as follows:
{
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"bun": "./dist/bun/index.js",
"import": "./dist/index.mjs",
"require": "./dist/cjs/index.js"
}
}
}
This should have fixed the problem with import and require separately.
since the
node
entry in package.json points to the cjs build, that's what's imported, but it seems like for some reason it results in the default export of theElysia
class going underexported.module.default.default
, and when marking elysia as external in esbuild, esbuild correctly insertsimport Elysia from "elysia"
in the resulting bundle, but the actual class still gets exported underElysia.default
, sonew Elysia
errors out, but editing the bundle manually to donew Elysia.default
makes it work properly.You can find some more info under https://github.com/evanw/esbuild/issues/3580
Importing Elysia as a named import rather than the default import with
import { Elysia } from "elysia"
works, but the@bogeychan/elysia-logger
plugin imports elysia via default import and I have no control of that