javascript - webpack packaging error
给我你的怀抱
给我你的怀抱 2017-06-12 09:31:13
0
2
909

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?

给我你的怀抱
给我你的怀抱

reply all(2)
伊谢尔伦

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...

世界只因有你

What is your node version? node -VTake a look

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template