emotion-js / emotion

👩‍🎤 CSS-in-JS library designed for high performance style composition
https://emotion.sh/
MIT License
17.51k stars 1.11k forks source link

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

Open guoyunhe opened 1 year ago

guoyunhe commented 1 year ago

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/through@2.3.8/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/@emotion+server@11.11.0/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/@emotion+server@11.11.0/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 git@github.com: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:

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

lorenzo-del-rosario commented 10 months ago

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

@guoyunhe have you found any solution?

guoyunhe commented 10 months ago

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