Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn OFF uglify in WebPack 2

Is there a way to skip the uglify js plugin from webpack 2 when runs in --production mode?

like image 542
Hitmands Avatar asked Jan 14 '17 13:01

Hitmands


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

Does Webpack use Uglify?

This plugin uses uglify-js to minify your JavaScript.

Does Uglify minify?

Uglify JS is a JavaScript library for minifying JavaScript files.

What is Uglify code?

Uglifying is transforming the code into an "unreadable" form by changing variable names, function names, etc, to hide the original content. Once it is used there's no way to reverse it back. Some libraries like UglifyJS does minification when used, by removing unnecessary parts.


1 Answers

Found: https://github.com/webpack/webpack/blob/9734d00d8bf0d306654f40e9b34b60db9c7fdda1/bin/config-optimist.js#L47

optimist
  .boolean("p")
  .describe(
    "p", 
    "shortcut for --optimize-minimize --define process.env.NODE_ENV=\"production\""
  )

A temp workaround would be run webpack --define process.env.NODE_ENV=\"production\"instead of webpack -p

like image 124
Hitmands Avatar answered Sep 25 '22 13:09

Hitmands