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?
伊谢尔伦2017-06-12 09:33:13
This is the code in iView
. Does the babel configured by webpack ignore the iView
directory because it is in node_modules
. For the correct configuration, please see https://github.com/iview/ivie...