You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I have been working on a project with Ajv, and I used
spack
to bundle the code but found a weird bug.The following is the minimum codebase to reproduce the bug:
entry.js:
ajv.js:
The console would print out
Uncaught ReferenceError: Ajv is not defined
.The
spack.config.js
has no any extra configuration but only entry and output.However, if I use
Ajv
directly in the entry file, the error is gone.The version of the module in the project:
@swc/cli
: 0.1.57@swc/core
: 1.2.242ajv
: 8.11.0I can't figure out why this happened and whether there are more packages with similar issue.
Thanks if any info provided!
Edited
Here is an example without
Ajv
:entry.js
module1.js
module2.js
The above code would give this:
Uncaught ReferenceError: __swcpack_require__ is not defined
I think the key point is that to import a CommonJs module in a ES6 module file (not the entry file).
Beta Was this translation helpful? Give feedback.
All reactions