Closed DenisLaboureyras closed 3 days ago
If you don't provide a reproduction, we cannot help you.
Here is the reproduction link: https://stackblitz.com/edit/jsx-email-repro-gkk1ey?file=package.json
In the terminal, "npm run dev" should triggered the error
Thanks. Looking into it.
I have a fix. Should be up within the hour.
Thanks a lot !
@jsxp-email/cli
Version?:Expected Behavior
The render function is working in CommonJS
Actual Behavior
I use a monorepo with pnpm and turborepo, when I trigger programmaticaly an email with the render function, the API throw this error:
ReferenceError: Cannot access 'exports' before initialization at loadConfig (/node_modules/.pnpm/jsx-email@2.1.2_@jsx-email+app-preview@1.2.6_@types+node@22.8.5_react@18.3.1_rollup@4.24.0_sa_mdygf2jpttdrtguyc2kz5zafcm/node_modules/jsx-email/src/config.ts:215:56) at render (/node_modules/.pnpm/jsx-email@2.1.2_@jsx-email+app-preview@1.2.6_@types+node@22.8.5_react@18.3.1_rollup@4.24.0_sa_mdygf2jpttdrtguyc2kz5zafcm/node_modules/jsx-email/src/renderer/render.ts:28:32)
The offending code in cjs is the following:
if (globalThis[exports.globalConfigSymbol]) return globalThis[exports.globalConfigSymbol]; ... const exports = searchResult?.config ?? {};
There is a mix between the exports keyword and the exports variable, you should rename the exports variable to avoid this name collision.
Additional Information