Bug report
What is the current behavior?
acorn's ChainExpression is not correctly parsed. Variables are not correctly resolved to imports when optional chaining is used.
import test from './test';
console.log(test.a)
console.log(test?.a)
compiles to
/* harmony import */ var _test__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./test */ "./src/test.js");
console.log(_test__WEBPACK_IMPORTED_MODULE_0__.default.a)
console.log(test?.a)
If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/SunriseFox/webpack-bug-optional-chaining
yarn && yarn start
What is the expected behavior?
should be
/* harmony import */ var _test__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./test */ "./src/test.js");
console.log(_test__WEBPACK_IMPORTED_MODULE_0__.default.a)
console.log(_test__WEBPACK_IMPORTED_MODULE_0__.default?.a)
Other relevant information:
webpack version: 5.0.0-beta.22
Node.js version: v12.16.3
Operating System: MacOS 10.15.5
Additional tools: none
Bug report
What is the current behavior?
acorn's ChainExpression is not correctly parsed. Variables are not correctly resolved to imports when optional chaining is used.
compiles to
If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/SunriseFox/webpack-bug-optional-chaining
yarn && yarn startWhat is the expected behavior?
should be
Other relevant information:
webpack version: 5.0.0-beta.22
Node.js version: v12.16.3
Operating System: MacOS 10.15.5
Additional tools: none