I have already used this in my webpack.config.js
use: [{
loader: 'babel-loader',
options: {
presets: ['es2015', 'es2016', 'react']
}
}]
But still I am getting error at the token let which I have used.
I get that uglify doesn't understands ECMAScript-6
Now when i build my webpack with -p, i get the mentioned error, because uglify es up there. Now, how can i solve this problem as I have already included babel-loader preset es2015 to convert es6 to es5.
I have already used this in my webpack.config.js
use: [{
loader: 'babel-loader',
options: {
presets: ['es2015', 'es2016', 'react']
}
}]
But still I am getting error at the token let which I have used.
I get that uglify doesn't understands ECMAScript-6
Now when i build my webpack with -p, i get the mentioned error, because uglify es up there. Now, how can i solve this problem as I have already included babel-loader preset es2015 to convert es6 to es5.
Share Improve this question asked Mar 18, 2018 at 12:10 ANURAG GUPTAANURAG GUPTA 1931 silver badge13 bronze badges 3- Can you tell us what is the error text you are getting at the token let ? – S Raghav Commented Mar 18, 2018 at 12:26
- UglifyJs failure, Unexpected token error: name (xyz) @raghav710 – ANURAG GUPTA Commented Mar 18, 2018 at 14:54
- I have fixed the issue as described in the following thread stackoverflow./questions/61606913/… – Julian Eduardo de Anquin Commented Jan 22, 2021 at 13:24
2 Answers
Reset to default 3As you've said, your current version of the Uglify plugin doesn't support ES6, so you'll need to upgrade. You have a few options:
- Upgrade to Webpack 4, which includes the new uglify plugin by default
- If you need to stay on v3 for whatever reason, you can follow the instructions on the docs here to install the new uglify plugin and use it manually.
Use terser-webpack-plugin for minifying ES6 code
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745280234a4620244.html
评论列表(0条)