Browser ESM build contains references to `process` which is undefined in browser
piotrekbator opened this issue · 1 comments
piotrekbator commented
Current behavior:
When using the dist/emotion-serialize.browser.esm.js
file available in the @emotion/serialize npm package in the browser (via CDN: https://ga.jspm.io/npm:@emotion/serialize@1.1.4/dist/emotion-serialize.esm.js in my case) I get a "ReferenceError: process is not defined". This is due to this file including some checks on node's process which is unavailable in the browser.
To reproduce:
Save this as a HTML file. After opening it in the browser, you'll see the error in the Console:
<!DOCTYPE html>
<html lang="en">
<head>
<script type="importmap">{
"imports": {
"@emotion/hash": "https://ga.jspm.io/npm:@emotion/hash@0.9.1/dist/emotion-hash.esm.js",
"@emotion/memoize": "https://ga.jspm.io/npm:@emotion/memoize@0.8.1/dist/emotion-memoize.esm.js",
"@emotion/serialize": "https://ga.jspm.io/npm:@emotion/serialize@1.1.4/dist/emotion-serialize.browser.esm.js",
"@emotion/unitless": "https://ga.jspm.io/npm:@emotion/unitless@0.8.1/dist/emotion-unitless.esm.js" }
}</script>
<script type="module">
import { serializeStyles } from "@emotion/serialize";
</script>
</head>
<body></body>
</html>
Expected behavior:
Just loading the file should not produce any JS errors.