Library is not compatible with ESM module with SSR
Closed this issue · 2 comments
netknight commented
Describe the bug
Library is not compatible with ESM module with SSR.
To Reproduce
- Create a new Remix application (latest & greatest).
- Import component like it described in Usage section of documentation
- Run
npm run dev
- Open app in browser (root page)
- See warning: (node:15013) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
- See error:
import { jsx as g } from "react/jsx-runtime";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1153:20)
at Module._compile (node:internal/modules/cjs/loader:1205:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at cjsLoader (node:internal/modules/esm/translators:283:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:308:24)
Expected behavior
Application launches normally
Additional context
- My package.json contains string:
"type": "module",
- I know that there are problems with configuring MUI with Remix, but it doesn't matter in this case.
I'm trying with correctly configured MUI/emotion for SSR that works without this component correctly. - Reproduces both: with standard Remix server & with Vite
viclafouch commented
Hello !
Do you have a sandbox for repro plz ?