Shaking a tree does not work - webpack 4 and uglifyjs-webpack-plugin

I tried adding UglifyJSPlugin to the webpack 4 project according to the webpack docs and I still see dead code and even comments in my package, which makes me think that my uglify plugin configuration is not used.

Link to the project

docs argue that "in order to take advantage of the yeast of trees, you must ...
- Use the syntax of the ES2015 module (i.e. Import and Export). done
- Add the entry "sideEffects" to the project.json file of the project. done .
- Include a minifier that supports dead code removal (e.g. UglifyJSPlugin). done

However, an unused / unimported function and comments on the left and left are included in my package.

The whole configuration can be seen here . Based on the results that I see, I suspect that this is due to guess the settings in my webpack configuration.

To play, drag repo and run yarn build

+5
source share

Source: https://habr.com/ru/post/1275981/


All Articles