Can't deploy or use emotion when edge runtime is active (Chakra UI + Remix + Vercel)
Current behavior:
Local development runs without issue. When deploying to Vercel, I got this error which was hard to pinpoint where it was coming from:
Error: The Edge Function "404" is referencing unsupported modules:
--
21:35:48.714 | - html-tokenize: stream
21:35:48.714 | - multipipe: stream
21:35:48.714 | - readable-stream: stream
21:35:48.714 | - through: stream
When commenting this line and its references it deploys without issues (also when commenting out the edge config):
import createEmotionServer from '@emotion/server/create-instance'
When having edge runtime off/commented out and trying to access edge functions I get this error:
ReferenceError: document is not defined
at (node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js:461:0)
at (build/build-edge-eyJydW50aW1lIjoiZWRnZSJ9.js:59:0)
at (build/build-edge-eyJydW50aW1lIjoiZWRnZSJ9.js:61:0)
at ([native code])
at (build/server-build-edge-eyJydW50aW1lIjoiZWRnZSJ9.mjs:2:18)
at ([native code])
To reproduce:
Add Chakra UI and its configurations
Add this line to activate Vercel edge
export const config = { runtime: 'edge' }
Deploy
Get deployment error
---- Alternative
Comment out import createEmotionServer from '@emotion/server/create-instance' and its references
Can't deploy or use emotion when edge runtime is active (Chakra UI + Remix + Vercel)
Current behavior:
Local development runs without issue. When deploying to Vercel, I got this error which was hard to pinpoint where it was coming from:
When commenting this line and its references it deploys without issues (also when commenting out the edge config):
import createEmotionServer from '@emotion/server/create-instance'
When having edge runtime off/commented out and trying to access edge functions I get this error:
To reproduce:
export const config = { runtime: 'edge' }
Get deployment error
---- Alternative
import createEmotionServer from '@emotion/server/create-instance'
and its referencesHere is a repo: https://github.com/yarapolana/testing-edge
Expected behavior:
Expected:
Environment information:
Thanks for your time.