14

How to remove dead code, but don't minimize code, using Webpack and UglifyJS?

1
  • 1
    Three minuses, but not comments, really? Commented Dec 14, 2015 at 16:09

1 Answer 1

3

You probably want to use the beautifier options. Minimum idea:

new webpack.optimize.UglifyJsPlugin({ beautify: true }) 
Sign up to request clarification or add additional context in comments.

4 Comments

See github.com/mishoo/UglifyJS2#compressor-options . Esp. dead_code. I read the initial description wrong.
But whai if I only want to remove dead code and leave everything untouched? Beautifier transforms my code in many different ways.
Maybe disable everything else then. I have a feeling Uglify wasn't designed particularly that use case in mind so using that feature alone may be tricky.
I got that feeling too because I already have disabled everything else and it still minimizes (unless I tell it to beutify but as I said before - that also transforms my code)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.