-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Closed
Description
Bug report
What is the current behavior?
- config
module.exports = {
plugins : [
new webpack.DefinePlugin({foo : 'aFoo', bar : 'aBar', crash : 'other.prop'})
]
}- source code
console.log({foo : foo, bar : bar}); // correct
console.log({foo, bar}); // incorrect
console.log({crash}); // SyntaxError: Unexpected token '.'- translated code
console.log({foo : aFoo, bar : aBar}); // correct
console.log({aFoo, aBar}); // incorrect
console.log({other.prop}); // SyntaxError: Unexpected token '.'If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
the shorthand property should expand before translate with DefinePlugin,
and only property value can be translated
Other relevant information:
webpack version: 5.75.0
Node.js version: 19.6.1
Operating System: macOs 13.2.1 (22D68)
Additional tools:
Reactions are currently unavailable