question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UglifyJsPlugin options.exclude does not work?

See original GitHub issue

When using the UglifyJsPlugin within my webpack build I get a large list of errors from my bower_components dependencies. It looks to me (from here: https://github.com/webpack/webpack/blob/master/lib/optimize/UglifyJsPlugin.js#L43) that I should be able to use something like this

new webpack.optimize.UglifyJsPlugin({
  exclude: [
    /bower_components\//
  ]
})

which continues to throw out a massive list of errors, leading me to believe they are still being parsed.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:6
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

31reactions
MilosRasiccommented, Oct 7, 2016

It’s working as expected, which is processing your generated chunks rather than source files. If you want to ignore only a few modules, extract them into a separate chunk and exclude that one from UglifyJsPlugin.

6reactions
MilosRasiccommented, Jan 18, 2018

@Sawtaytoes

new webpack.optimize.UglifyJsPlugin({
	exclude: 'chunkToNotUglify',
}),
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to exclude uglification for *.min.js in webpack
UglifyJsPlugin always runs on the entire webpack JS output. There is no way to specify any chunks or modules to ignore o exclude....
Read more >
UglifyjsWebpackPlugin
This plugin uses UglifyJS v3 ( uglify-es ) to minify your JavaScript ... Files to exclude ... cheap-source-map options don't work with this...
Read more >
UglifyjsWebpackPlugin
This plugin uses uglify-js to minify your JavaScript. ... Files to exclude. webpack.config.js ... cheap-source-map options don't work with this plugin.
Read more >
uglifyjs-webpack-plugin - npm
This plugin uses UglifyJS v3 (`uglify-es`) to minify your JavaScript ... cheap-source-map options don't work with this plugin ...
Read more >
demo/node_modules/uglifyjs-webpack-plugin - GitLab
exclude. webpack.config.js. [ new UglifyJsPlugin({ exclude: /\/excludes/ }) ] ... cheap-source-map options don't work with this plugin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found