emotion icon indicating copy to clipboard operation
emotion copied to clipboard

@emotion/server depends on through which doesn't work with Remix Oxygen runtime

Open guoyunhe opened this issue 1 year ago • 2 comments

Current behavior:

@emotion/server throws error on Remix Oxygen runtime.

Error: Dynamic require of "stream" is not supported
    at file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:11:9
    at node_modules/.pnpm/[email protected]/node_modules/through/index.js (file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:30080:18)
    at file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:17:50
    at node_modules/.pnpm/@[email protected]/node_modules/@emotion/server/create-instance/dist/emotion-server-create-instance.cjs.dev.js (file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:32189:19)
    at file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:17:50
    at node_modules/.pnpm/@[email protected]/node_modules/@emotion/server/create-instance/dist/emotion-server-create-instance.cjs.js (file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:32293:22)
    at file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:17:50
    at file:///home/guo/git/material-ui/examples/material-ui-remix-ts/dist/worker/index.js?t=1700662329530.0657:36725:57
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at ModuleLoader.import (node:internal/modules/esm/loader:316:24)

To reproduce:

https://github.com/guoyunhe/material-ui/tree/remix-oxygen

git clone [email protected]:guoyunhe/material-ui.git
cd material-ui/examples/material-ui-remix-ts
git checkout remix-oxygen
cp .env.example .env
npm install
npm run dev

Expected behavior:

Should work.

Environment information:

  • react version: 18.2.0
  • @emotion/react version: 1.11.1

See also https://github.com/mui/material-ui/issues/39929

guoyunhe avatar Nov 22 '23 14:11 guoyunhe

I'm having the same issue implementing createEmotionCache and createEmotionServer in the entry.server.tsx.

@guoyunhe have you found any solution?

lorenzo-del-rosario avatar Jan 17 '24 21:01 lorenzo-del-rosario

@lorenzo-del-rosario no, I simply dropped emotion in the end...

guoyunhe avatar Jan 18 '24 01:01 guoyunhe