Repository navigation
Error: 'default' is not exported #1257
Replies: 1 comment
|
In the linked revision, the important part is the end of the emitted I reproduced this with the versions from that revision's lockfile: TypeScript 4.8.2, Rollup 2.79.0, and export {};The output now mixes CommonJS assignment with ES-module syntax. Bundling the wrapper with A small fix for this generated file is to preserve its original CommonJS contents when staging node -e "require('node:fs').copyFileSync('src/witness_calculator.cjs', 'dist/witness_calculator.cjs')"Then leave the wrapper as: import builder from './witness_calculator.cjs';
export { builder };In the isolated reproduction, that one replacement makes the bundle succeed without warnings; importing the resulting ESM bundle exposes The CommonJS plugin already explicitly handles This verifies the reported export/bundling failure using the original calculator source, not the entire RLN application or execution of its WASM circuit. |
Uh oh!
There was an error while loading. Please reload this page.
This seems to be a common error but I am not able to understand how to resolve it.
The code is here: https://github.com/waku-org/js-rln/tree/18176e33c06c35a78af25b512f7615617c2c0775
I am getting
So builder is exported as default.
in
dist/witness_calculator.cjs:in
dist/witness_calculator.js:My rollup config:
I am not sure to understand why rollup does not find the default export?
All reactions