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
If you import a CommonJS module from an ES6 module, non-enumerable properties are sometimes imported and sometimes not imported depending on the import syntax used. This situation comes up when a CommonJS module does module.exports = class { static property() {} }. In that case property is non-enumerable.
If the current behavior is a bug, please provide the steps to reproduce.
Note that the code above uses test[Math.random() < 2 && 'property'] to represent a dynamic property access. It's not the intention of this issue to special-case that syntax to behave like test.property.
Other relevant information:
webpack version: 5.4.0
Node.js version: v12.18.3
Operating System: linux
Additional tools:
I'm working on improving esbuild's compatibility with other bundlers. This inconsistency tripped me up in the past when trying to figure out what forms of importing Webpack supports. Ideally it would be consistent. I'm guessing no one else has pointed this out yet so I figured I should log an issue. Here's the context: evanw/esbuild#532 (comment).
The text was updated successfully, but these errors were encountered:
Bug report
What is the current behavior?
If you import a CommonJS module from an ES6 module, non-enumerable properties are sometimes imported and sometimes not imported depending on the import syntax used. This situation comes up when a CommonJS module does
module.exports = class { static property() {} }
. In that caseproperty
is non-enumerable.If the current behavior is a bug, please provide the steps to reproduce.
Repro: https://repl.it/@EvanWallace1/webpack-commonjs-import-inconsistency
Note that the code above uses
test[Math.random() < 2 && 'property']
to represent a dynamic property access. It's not the intention of this issue to special-case that syntax to behave liketest.property
.What is the expected behavior?
Expected:
Either this:
Or this:
Observed:
Other relevant information:
webpack version: 5.4.0
Node.js version: v12.18.3
Operating System: linux
Additional tools:
I'm working on improving esbuild's compatibility with other bundlers. This inconsistency tripped me up in the past when trying to figure out what forms of importing Webpack supports. Ideally it would be consistent. I'm guessing no one else has pointed this out yet so I figured I should log an issue. Here's the context: evanw/esbuild#532 (comment).
The text was updated successfully, but these errors were encountered: