Error when Uglifying with Webpack 4
See original GitHub issueSuperagent Version: 4.0.0-beta.5 Webpack Version: 4.19.1 UglifyJS Webpack Plugin: 2.0.1
Appears to have an issue when running a production build in Webpack 4 with UglifyJS.
ERROR in bundle.js from UglifyJs Unexpected token: name (root) [./node_modules/superagent/lib/client.js:5,0]...
Possibly an issue with using the reserved keyword ‘root’.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Error when Uglifying with Webpack 4 · Issue #1415 - GitHub
Appears to have an issue when running a production build in Webpack 4 with UglifyJS. ERROR in bundle.js from UglifyJs Unexpected token: name...
Read more >Webpack 4 and Uglify Plugin (TypeError: Cannot read ...
Setting mode to production in Webpack v4 should do enough optimisations, so there's no need to specifically require the Uglify plugin.
Read more >UglifyjsWebpackPlugin | webpack
This plugin uses uglify-js to minify your JavaScript. ... Custom logic for extract comments const { error, map, code, warnings } = require('uglify-module') ......
Read more >uglify-js - npm
UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. Note: uglify-js supports JavaScript and most language features in ...
Read more >uglifyjs-webpack-plugin - npm.io
webpack.config.js module.exports = { optimization: { minimizer: [ new UglifyJsPlugin({ chunkFilter: (chunk) => { // Exclude uglification for the `vendor` ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No, you are wrong it’s not a problem of Uglify plugin.
It’s because many people use webpack this way:
so the const/let etc… will not be transpiled to es5.
add a rule:
will fix this problem.
Situation1: People usually use webpack to bundle with loaders exclude file in node_modules Situation2: Some package don’t provide es5 version, or use module: es6version in package.json
Situation1 + Situation2 = the code send to uglify plugin would be es6 version, causing this problem.
@djizco Hi! How did you solve the issue? What do you mean of switching to ES5 version?