TS CommonJS builds broken with a Node.js backend
Closed this issue · 3 comments
affanshahid commented
- Component or Package Name: jsx-email
- Component or Package Version: 1.7.0
@jsxp-email/cli
Version?: 3.0.1- Operating System (or Browser): macOS / Chrome
- Node Version: 19.8.1
- Link to reproduction (
⚠️ read below): https://stackblitz.com/edit/jsx-email-repro-ey549j?file=tsconfig.json
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.
shellscape commented
Thanks for raising the issue. We'll take a look at a fix for this.
tandpfun commented
@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
shellscape commented
@tandpfun that's a separate issue, please open a new issue with a reproduction