shellscape/jsx-email

TS CommonJS builds broken with a Node.js backend

Closed this issue · 3 comments

Expected Behavior

Typescript apps built using the CommonJS output should run.

Actual Behavior

The app crashes with the following error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/.pnpm/shikiji@0.8.7/node_modules/shikiji/dist/index.mjs not supported.

Additional Information

You can reproduce the error in the reproduction by running npm run produce-error in the terminal (tsc && node ./dist/main.js). I tried different values in tsconfig to somehow work around this but nothing worked, for different reasons.

Thanks for raising the issue. We'll take a look at a fix for this.

@shellscape I'm still getting a similar issue on 1.7.2 with the same "shikiji" package in NextJS, but with a different file.

export 'addClassToHast' (reexported as 'addClassToHast') was not found in './core.mjs' (module has no exports)

Import trace for requested module:
./node_modules/.pnpm/shikiji@0.8.7/node_modules/shikiji/dist/index.mjs
./node_modules/.pnpm/jsx-email@1.7.2_@types+node@20.10.7_@types+react-dom@18.2.18_@types+react@18.2.47_react@18.2.0/node_modules/jsx-email/dist/index.mjs
./src/app/api/admin/email/send-test/route.ts

@tandpfun that's a separate issue, please open a new issue with a reproduction