Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack 4 disable uglifyjs-webpack-plugin

I have had this problem for the last 2 days. So I decided to completely disable uglifyjs-webpack-plugin from webpack build process. I was not able to find anything on webpack 4.

like image 372
yacine benzmane Avatar asked Jul 10 '18 11:07

yacine benzmane


People also ask

How do I disable Uglify?

To disable it, you can do --js-opts 0 which will disable the JS optimizer. For small JS sizes that's probably ok (and you can run your own JS minifier later if you want).

How do I minify JS files in webpack?

In webpack, minification process is controlled through two configuration fields: optimization. minimize flag to toggle it and optimization. minimizer array to configure the process. To tune the defaults, we'll attach terser-webpack-plugin to the project so that it's possible to adjust it.

How do you use Terser webpack plugins?

Using Webpack v4, you have to install terser-webpack-plugin v4. const TerserPlugin = require("terser-webpack-plugin"); module. exports = { optimization: { minimize: true, minimizer: [new TerserPlugin()], }, }; And run webpack via your preferred method.

What is Uglifyjsplugin?

UglifyJS is a JavaScript compressor/minifier written in JavaScript. It also contains tools that allow one to automate working with JavaScript code: A parser which produces an abstract syntax tree (AST) from JavaScript code.


1 Answers

module.exports = {
    optimization:{
        minimize: false, // <---- disables uglify.
        // minimizer: [new UglifyJsPlugin()] if you want to customize it.
    }
}
like image 164
PlayMa256 Avatar answered Nov 04 '22 21:11

PlayMa256