Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser ESM build contains references to process which is undefined in browser #3191

Open
piotrekbator opened this issue May 21, 2024 · 0 comments

Comments

@piotrekbator
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant