javascript - Webpack plug-in UglifyJsPlugin feels contradictory when reading the documentation?
过去多啦不再A梦
过去多啦不再A梦 2017-05-19 10:46:29
0
1
694

1. First of all, the official website "Guide" says that UglifyJsPlugin is a built-in plug-in, just use it directly

2. Then on the plug-in introduction page, it says that UglifyJsPlugin requires the plug-in to be installed to use it, and also

const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

State this sentence as required, but doesn’t it contradict the first point?


So: I gave it a try and found that there is no need to install or declare require, and it can be used directly

Then, I was a little confused...

过去多啦不再A梦
过去多啦不再A梦

reply all(1)
左手右手慢动作

webpack.optimize.UglifyJsPlugin is the core plug-in of webpack. It comes with it and can be used directly.

And webpack.optimize.UglifyJsPluginuglifyjs-webpack-plugin and uglifyjs-webpack-plugin are the same plug-in,
It is mentioned in the first paragraph of your second picture, and the purpose is also mentioned, You can install the specified UglifyJS version , instead of using the one that comes with webpack, this is the only difference.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template