When using webpack2.x to package, the following error occurs (Unexpected token name «i», expected punc «;»):
ERROR in app.js from UglifyJs
Unexpected token name «i», expected punc «;» [app.js:9461,13]
The error reported is:
function oneOf (value, validList) {
for (let i = 0; i < validList.length; i++) {//此行报错
if (value === validList[i]) {
return true;
}
}
return false;
}
It seems that the UglifyJs compression plug-in made an error when encountering es6 syntax. However, the code I wrote in the project was compiled with babel, and the code reporting the error above should come from the vue library. Why are these codes not compiled by babel before performing UglifyJs compression?
This is the code in
iView
. Does the babel configured by webpack ignore theiView
directory because it is innode_modules
. For the correct configuration, please see https://github.com/iview/ivie...What is your
node
version?node -V
Take a look