-
-
Notifications
You must be signed in to change notification settings - Fork 291
Description
Hi :-)
The options docs say:
minify:boolean. If set totrueorfalse, theServiceWorker's output will be minified or not accordingly. If set to something else, theServiceWorkeroutput will be minified if you are usingwebpack.optimize.UglifyJsPluginin your configuration.
Default:null
The check for that uses plugins to determine whether the user has activated minification:
https://github.com/NekR/offline-plugin/blob/v5.0.2/src/service-worker.js#L143-L146
However in webpack 4, UglifyJsPlugin is typically not added to plugins, but instead used via the new optimization.minimizers option (the plugin is added there by default, but people can override) which is toggled via the optimization.minimize bool:
https://github.com/webpack/webpack/blob/v4.6.0/lib/WebpackOptionsDefaulter.js#L270-L289
https://github.com/webpack/webpack/blob/v4.6.0/lib/WebpackOptionsApply.js#L334-L338
To allow the minify option auto-detection to work under both webpack 2-3 and webpack 4, I guess the conditional needs to be a combination of the existing plugins check and also optimization.minimize?