You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to import mjml in node enviroment in production I get a 500 error and with this error require is not defined in ES module scope, you can use import instead
HOST=127.0.0.1 PORT=4000 node build - 500 error, check logs for more info
Logs
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/dcheglakov/mjml-import/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:149351:7
at requireNode (file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:149458:3)
at requireHtmlminifier (file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:149473:17)
at file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:157908:23
at requireLib$r (file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:158308:3)
at file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:164583:43
at requireLib (file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:164594:3)
at file:///Users/dcheglakov/mjml-import/build/server/chunks/2-47b89ce5.js:164598:18
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Hello everyone!
I've spent 1.5days to workaround in the context of the directus extensions build system
I got the same error, and after investigation found that the source of the error was html-minifier package. I've tried all options (mjml-browser, mrml (wasm bindings)).
And on this issue I found this magic lines
Describe the bug
When trying to import
mjml
in node enviroment in production I get a 500 error and with this errorrequire is not defined in ES module scope, you can use import instead
I've checked
mjml
on publint no errors, all good.Reproduction
A reproduction of the issue can be found at https://github.com/dcheglakov/sveltekit-mjml-import
To reproduce:
pnpm i
ornpm i
pnpm dev
- everything is finepnpm build
thenpnpm preview
- everything is fineHOST=127.0.0.1 PORT=4000 node build
- 500 error, check logs for more infoLogs
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response
The text was updated successfully, but these errors were encountered: