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

Parcel + D3.js: Uncaught ReferenceError $22b18e23564de7e8$exports is not defined #8849

Closed
ni2scmn opened this issue Feb 21, 2023 · 1 comment

Comments

@ni2scmn
Copy link

ni2scmn commented Feb 21, 2023

🐛 bug report

I tried to reproduce a minimal web application with parcel as a build tool and the d3.js library.
If I run npx parcel src/index.html, I can see that everything works as expected.
However with the build version by npx parcel build src/index.html I get the error Uncaught ReferenceError: $22b18e23564de7e8$exports is not defined which points to the imported d3.variable.
I built the same minimal example with vite which worked as expected.

package.json

{
  "name": "parcel-d3-example",
  "version": "1.0.0",
  "devDependencies": {
    "parcel": "^2.8.3"
  },
  "dependencies": {
    "d3": "^7.4.2"
  }
}

demo.js

import * as d3 from "d3";

d3
    .select('h1')
    .text('Hello World')

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <h1>Hello</h1>
    <script src="demo.js" type="module"></script>
  </body>
</html>

🤔 Expected Behavior

When opening the built site, you should see 'Hello World' in the h1 tag and no error message.

😯 Current Behavior

Screenshot 2023-02-21 at 21 57 50

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.8.3
Node 19.4.0
npm/Yarn 9.2.0
Operating System MacOS 13.2.1 (M1)
@mischnic
Copy link
Member

Duplicate of #8792

@mischnic mischnic marked this as a duplicate of #8792 Feb 23, 2023
@mischnic mischnic closed this as not planned Won't fix, can't repro, duplicate, stale Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants