last-call-webpack-plugin
last-call-webpack-plugin copied to clipboard
Add webpack 5 support
As webpack 5 has multiple deprecations, it seems this plugin is facing some of them as well. It seems the plugin still works but the APIs it depends on will be gone in the future.
I'm using the plugin through optimize-css-assets-webpack-plugin and when you use last-call-webpack-plugin, it emits the following deprecation warning:
DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hook.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
I believe you may need to add a check against webpack 4/5 (see https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/src/index.js for reference) and then adapt to the new API.
Tried to fix this issue: https://github.com/NMFR/last-call-webpack-plugin/pull/9
@NMFR
@bebraw There is nothing holding you back using optimize-css-assets-webpack-plugin, but you could swap it for css-minimizer-webpack-plugin.
The description says
Just like optimize-css-assets-webpack-plugin but more accurate with source maps and assets using query string, allows to cache and works in parallel mode.
And it doesn't use the deprecated hook call.
@jarroput Yup, that plugin is my official recommendation.
I would say fixing this issue is worth it given this particular plugin is getting five million downloads per week at the moment while the other one is hovering around 230k.
The fix in #9 looks adequate.
I second this. #9 looks mergable to me as well.
there is
(node:35546) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
because of last-call-webpack-plugin https://github.com/NMFR/last-call-webpack-plugin/blob/master/src/index.js#L176
any updates?
@nikbelikov It's probably better to migrate to https://www.npmjs.com/package/css-minimizer-webpack-plugin or fork this one with the webpack 5 fix as the author seems busy.