webpack-contrib / babel-minify-webpack-plugin

[DEPRECATED] Babel Minify Webpack Plugin
MIT License
491 stars 44 forks source link

Improve the minification speed #71

Closed avesus closed 6 years ago

avesus commented 6 years ago

Minification sample: @angular/core.

0.2.0 consumes 20 seconds of precious developer time on default settings (unfortunately, I had to use cheap-module-source-map and turn off the devtool: 'source-map' setting because of the weird bug https://github.com/webpack-contrib/babel-minify-webpack-plugin/issues/68).

Bundling with UglifyJSPlugin takes 2 seconds with "generator" settings (mangle and compress equals false), and 8 seconds on maximum settings (with compress: { passes: 2 }).

Bundling the same code with webpack without any minifiers, then passing the generated bundle to the babylon parser, and printing the resulting AST with @babel/generator takes 3 seconds.

The "generator" settings are very important nowadays, when everything can be gzipped and sent over HTTP/2.

The fancy ES Modules do have unsolvable problem of race conditions on updates, so bundling will be always actual and necessary on serious deployments with high loads.

One interesting philosophy is "code isomorphism between production and development environment" which encourages developers to work with and debug the same code which clients finally use.

To simplify debugging of production bundles, use of variables mangling and compression (which may flatten nested function calls etc.) should be avoided. Such simple minification setting improves the speed of bundle code generation, which is great.

I was expecting that the plugin may do its work very fast, but even was unable to disable the mangle setting.

boopathi commented 6 years ago

This issue is not related to this webpack plugin. I'll close this here. We are already working on improving babel-minify's performance and babel-7 upgrade. Feel free to open issues in babel-minify repository for babel-minify related issues.

Thanks!