Closed edmorley closed 6 years ago
Hi @edmorley!
I think the definition of ServiceWorker.minify
is quite right. It exactly does what it says.
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:
The optimization.minimize
supposed to add Uglify plugin to plugins list, unless you're using some custom minifier.
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?
That would be too complicated, I think. I would prefer it to be as is, but if it doesn't work and isn't able to catch the plugin added by optimization.minimize
, then it probably has to be changed.
The optimization.minimize supposed to add Uglify plugin to plugins list, unless you're using some custom minifier.
I could be reading the webpack source incorrectly - but if you see the second source link above, it doesn't actually modify the plugins list, but applies the plugin separately.
As such, I'm pretty sure this issue is real.
Many thanks :-)
Should be fixed now: https://github.com/NekR/offline-plugin/releases/tag/v5.0.3
Hi :-)
The options docs say:
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-L146However 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 theoptimization.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-L338To 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 alsooptimization.minimize
?