Bug report
What is the current behavior?
Under some circumstances, the tree shaking process for an unused default export would only remove the variable definition while still preserves the variable reference in an expression like var _unused_webpack_default_export = (style), causing a ReferenceError in browsers.
Since webpack 5.0.0-beta.14 turned optimization.usedExports on by default, this bug became quite noticeable.
If the current behavior is a bug, please provide the steps to reproduce.
git clone https://github.com/sodatea/webpack-used-exports-bug.git
cd webpack-used-exports-bug
yarn && yarn start
Then visit http://localhost:5000/example/index.html to see the error message.
What is the expected behavior?
Other relevant information:
webpack version: v5.0.0-beta.14
Node.js version: v12.16.1
Operating System: macOS Catalina 10.15.3
Additional tools: None
Bug report
What is the current behavior?
Under some circumstances, the tree shaking process for an unused default export would only remove the variable definition while still preserves the variable reference in an expression like
var _unused_webpack_default_export = (style), causing aReferenceErrorin browsers.Since webpack 5.0.0-beta.14 turned
optimization.usedExportson by default, this bug became quite noticeable.If the current behavior is a bug, please provide the steps to reproduce.
Then visit http://localhost:5000/example/index.html to see the error message.
What is the expected behavior?
webpack.config.jsto turn offoptimization.usedExportsyarn startOther relevant information:
webpack version: v5.0.0-beta.14
Node.js version: v12.16.1
Operating System: macOS Catalina 10.15.3
Additional tools: None