parcel: $78fb23f46eb09f80$exports is not defined
We run into this problem after we added chartjs-plugin-datalabels to our project. When serving the result from parcel build
we get the runtime error:
Uncaught ReferenceError: $78fb23f46eb09f80$exports is not defined
<anonymous> http://0.0.0.0:8000/index.059a8e3e.js:25
Disabling scope hoisting (--no-scope-hoist
) makes it work. Parcel 2.7 works, 2.8.0 does not.
Removing the following line from package.json in chartjs-plugin-datalabels also makes it work:
"module": "dist/chartjs-plugin-datalabels.esm.js",
not sure if it’s relevant.
A minimal example for reproducing the error: https://ommej.se/files/tmp/parcel-6711.tar.gz.
Steps to reproduce:
$ npm install
$ npm run build
$ cd dist
$ python3 -m http.server
(or some other way to serve the files)
visit the page in a browser, for example localhost:8000, the console will show the exception
_Originally posted by @lanker in https://github.com/parcel-bundler/parcel/issues/6711#issuecomment-1403472548_
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 17 (6 by maintainers)
Commits related to this issue
- Minimal setup for reproduce D3 error with Parcel 2.8.3 https://github.com/parcel-bundler/parcel/issues/8792 — committed to OzzyCzech/d3-parcel-error by OzzyCzech a year ago
- Work around parceljs bug https://github.com/parcel-bundler/parcel/issues/8792 — committed to FydeOS/fydeRhythm by t123yh a year ago
Thanks, I already have a minimal reproduction for now:
output:
Thanks @phfaist your hotfix works - see example error repository
For reference, I’m having a similar issue when trying to import the ‘yaml’ package, because apparently its main
index.js
contains such export all/rename export instructions. My workaround for now has been to add an alias that directly points to the module where the definitions are located,"alias": { "yaml": "node_modules/yaml/browser/dist/index.js", ...}
Yes, it’s caused by having both a
export *
and then a renamingexport {x as y}
(as in my example)I workaround by just doing
console.log(d3)
after the import (I wanted to check what was being inported, and… ¯\ (ツ) /¯ )Have same issue as @tnarik with D3 and Parcel 2.8.3 version
seems to be missing in the bundle and generates
87f3b181d7e461d2$exports is not defined
error