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
The module loaded has an unexpected export createElement.
It seems although the exports passed to the module a are not node.js's native exports, it still changed the native exports. This maybe a bug in dynamic import.(The problem only occurs in the case of dynamic import)
If esbuild can avoid the keyword exports in __commonJS function, or provide some overriding configuration
, may solved this problem.
The text was updated successfully, but these errors were encountered:
This is a bug in node. Node is trying to guess at what exports the module has and it's guessing wrong. If I rename exports to not_exports then the bug isn't triggered. Node isn't doing the correct scope analysis to determine whether exports is from the top-level module or a nested module. It just makes up an export called foo if it finds an assignment to exports.foo anywhere in the source code, even if exports is a local variable. I can try to have esbuild avoid naming variables exports when targeting node to work around this bug in node.
Minimal repro:
Esbuild config:
Outputted bundle.js:
When use 'import()' to dynamic load bundle.js
The module loaded has an unexpected export
createElement
.It seems although the
exports
passed to the modulea
are not node.js's nativeexports
, it still changed the native exports. This maybe a bug in dynamic import.(The problem only occurs in the case of dynamic import)If esbuild can avoid the keyword
exports
in__commonJS
function, or provide some overriding configuration, may solved this problem.
The text was updated successfully, but these errors were encountered: