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
When destructuring using already existing variables (i.e. without const/let/var), imports used as defaults will cause an exception at runtime when trying to access them, e.g. ReferenceError: foo is not defined. Note that there seems to be no problem when using CommonJS syntax.
If the current behavior is a bug, please provide the steps to reproduce.
It's easy to see why this is happening in the compiled output:
...
/* harmony import */var__WEBPACK_IMPORTED_MODULE_0__foo__=__webpack_require__(0);constbar='bar';letval;[val=bar]=[];console.log(val);// "bar"({ val =bar}={});console.log(val);// "bar"const[val2=__WEBPACK_IMPORTED_MODULE_0__foo__["a"/* default */]]=[];console.log(val2);// "foo"const{ val3 =__WEBPACK_IMPORTED_MODULE_0__foo__["a"/* default */]}={};console.log(val3);// "foo"[val=foo]=[];// ReferenceError: foo is not defined({ val =foo}={});// ReferenceError: foo is not defined
What is the expected behavior?
Behaves as it would in other destructuring situations.
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Webpack 2.5.1
Node 7.10
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When destructuring using already existing variables (i.e. without
const/let/var
), imports used as defaults will cause an exception at runtime when trying to access them, e.g.ReferenceError: foo is not defined
. Note that there seems to be no problem when using CommonJS syntax.If the current behavior is a bug, please provide the steps to reproduce.
https://gist.github.com/noinkling/218dc503dc6bb5f844fa53c8a0bc1d32
It's easy to see why this is happening in the compiled output:
What is the expected behavior?
Behaves as it would in other destructuring situations.
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Webpack 2.5.1
Node 7.10
The text was updated successfully, but these errors were encountered: