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
Both imports from symbol and symbol2 return the .default field because they are both compiled from an ES module and contain the __esModule field.
Actual Behavior
The CommonJS plugin only recognizes the one with exports.__esModule. The one with module.exports = { __esModule: true, default: ... } is treated as a normal CJS module.
#942)
* fix(commonjs): convert module.exports with `__esModule` property(#939)
* test(commonjs): add test sample for cjs with esm-property
* feat(commonjs): defaultIsModuleExports support module.exports
* fix(commonjs): do not check right node in module.exports reassgin when defaultIsModuleExports = false(#935)
Expected Behavior
Both imports from
symbol
andsymbol2
return the.default
field because they are both compiled from an ES module and contain the__esModule
field.Actual Behavior
The CommonJS plugin only recognizes the one with
exports.__esModule
. The one withmodule.exports = { __esModule: true, default: ... }
is treated as a normal CJS module.Additional Information
The
module.exports = { __esModule: true, default: ... }
pattern is found inbabel-runtime
v6 https://unpkg.com/browse/babel-runtime@6.26.0/core-js/symbol.jsIt is used in some old codebases. So this issue causes incompatibility with them.
See also vitejs/vite#4090
The text was updated successfully, but these errors were encountered: