webpack-uglify-parallel icon indicating copy to clipboard operation
webpack-uglify-parallel copied to clipboard

Support for unminified-webpack-plugin

Open AndyOGo opened this issue 9 years ago • 5 comments

How about compatability/support for unminified-webpack-plugin?

AndyOGo avatar Oct 11 '16 13:10 AndyOGo

Hi! You mean to be able to generate unminified files in parallel?

w0rse avatar Oct 11 '16 13:10 w0rse

@w0rse Hi, yes exactly, but without having webpack being run twice, just in one go.

AndyOGo avatar Oct 11 '16 15:10 AndyOGo

unminified-webpack-plugin checks for the presence of the UglifyJsPlugin in the configuration with an instanceof test.

I worked around this by doing the following:

const UglifyJsParallelPlugin = require('webpack-uglify-parallel');
UglifyJsParallelPlugin.prototype = Object.assign(new webpack.optimize.UglifyJsPlugin(), UglifyJsParallelPlugin.prototype);

kfeinUI avatar Nov 01 '16 19:11 kfeinUI

Looks a bit hacky :) We should work with unminified-webpack-plugin author to remove the strong check for UglifyJsPlugin.

w0rse avatar Nov 02 '16 11:11 w0rse

Conceptually, extending UglifyJsPlugin makes sense. The difficulty is that its not designed/executed in a friendly way to support this. If they broke up the monolithic apply() into smaller pieces, you could easily reuse what they already offer without duplication. My workaround effectively overrides the bulk of the code of the original, but makes the type checking happy.

kfeinUI avatar Nov 02 '16 17:11 kfeinUI