Expected Behavior
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.
Additional Information
The module.exports = { __esModule: true, default: ... } pattern is found in babel-runtime v6 https://unpkg.com/browse/[email protected]/core-js/symbol.js
It is used in some old codebases. So this issue causes incompatibility with them.
See also vitejs/vite#4090
Expected Behavior
Both imports from
symbolandsymbol2return the.defaultfield because they are both compiled from an ES module and contain the__esModulefield.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-runtimev6 https://unpkg.com/browse/[email protected]/core-js/symbol.jsIt is used in some old codebases. So this issue causes incompatibility with them.
See also vitejs/vite#4090