When can webpack 5 be perfectly supported?
It is a great plugin.
I'm using Webpack 5 and I don't have any issue using this plugin. What's your issue?
@kud This is the issue https://github.com/stephencookdev/speed-measure-webpack-plugin/issues/170
(node:4422) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader at getNormalModuleLoader (node_modules/webpack/lib/Compilation.js:408:39) at Object.get normalModuleLoader [as normalModuleLoader] (node_modules/webpack/lib/Compilation.js:841:12) at genProxy (node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:124:34) at node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:152:19 at Array.reduce (<anonymous>) at wrapHooks (node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:151:38) at Object.get (node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:221:18) at Proxy.<anonymous> (node_modules/ignore-emit-webpack-plugin/index.js:64:33) at node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19 at Hook.eval [as call] (eval at create (node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:98:1)
I do need this in webpack 5 with CRA V5 ~
@kud This is the issue #170
I need terser-webpack-plugin and css-minimizer-webpack-plugin, what should I do in this case?
@w-t-w I'm guessing you can simply instantiate both plugins and be on your own with minimization:
const TerserPlugin = require("terser-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
module.exports = {
optimization: {
minimize: true,
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
},
};
Initialize TerserPlugin to your own taste https://webpack.js.org/plugins/terser-webpack-plugin/#options
So that minimizer array doesn't have an '...' item and speed measure plugin would work for you.
@g3tr1ght So I have to download terser-webpack-plugin without the convenience of webpack mode:'production', but this is not solving the problem, is it? It's sort of bypassing the problem, right?
@w-t-w terser-webpack-plugin is a transitive dependency for you in any case, you either pin it in your package.json and instantiate yourself (make it direct dependency) or let webpack instantiate it for you (keep it transitive). In either case, this dependency will end up installed: https://github.com/webpack/webpack/blob/main/package.json#L29
Also you aren't losing the convenience of webpack mode:'production'. It'll still apply to the config all production optimizations, except optimization.minimizer portion as you overrode it (if you'll follow the example above).
Here's what '...' option in optimization.minimizer does: https://github.com/webpack/webpack/blob/main/lib/config/defaults.js#L77-L114.
As you can see from the function A definition, it's pretty basic, whenever it stumbles upon '...', it'll add the default option, which is provided here: https://github.com/webpack/webpack/blob/main/lib/config/defaults.js#L1160-L1174. So if you have optimization.minimizer = ['...', new CssMinimizerPlugin()] (which is what you originally wanted to use), webpack will effectively "convert" it into: optimization.minimizer = [new TerserPlugin({ terserOptions: { compress: { passes: 2 } } }), new CssMinimizerPlugin()].
Which means it actually solves the problem. I understand it's a workaround, but the end result is identical to the webpack "baseline". And more so, serious projects usually have a good number of customizations which override webpack default production optimizations.
(node:4422) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader at getNormalModuleLoader (node_modules/webpack/lib/Compilation.js:408:39) at Object.get normalModuleLoader [as normalModuleLoader] (node_modules/webpack/lib/Compilation.js:841:12) at genProxy (node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:124:34) at node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:152:19 at Array.reduce (<anonymous>) at wrapHooks (node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:151:38) at Object.get (node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:221:18) at Proxy.<anonymous> (node_modules/ignore-emit-webpack-plugin/index.js:64:33) at node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19 at Hook.eval [as call] (eval at create (node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:98:1)
any updates on this?
@ssmartin I'm also still getting this on every build, and it's driving me nuts.
Everything is working and the build runs just fine, I just consistently get that warning.