viclafouch/mui-chips-input

Library is not compatible with ESM module with SSR

Closed this issue · 2 comments

Describe the bug
Library is not compatible with ESM module with SSR.

To Reproduce

  1. Create a new Remix application (latest & greatest).
  2. Import component like it described in Usage section of documentation
  3. Run npm run dev
  4. Open app in browser (root page)
  5. See warning: (node:15013) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
  6. 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

  1. My package.json contains string:
  "type": "module",
  1. 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.
  2. Reproduces both: with standard Remix server & with Vite

Hello !

Do you have a sandbox for repro plz ?

Hey! I got the same bug for the use case here: #41