Incompatibility with some other webpack plugins
someden opened this issue · 6 comments
I found some plugins that causes errors while use with speed-measure-webpack-plugin
Environment
"speed-measure-webpack-plugin": "1.4.2",
"webpack": "5.21.2",
"webpack-cli": "4.5.0",
Plugin: "terser-webpack-plugin": "5.1.1"
Simple config to reproduce:
const TerserPlugin = require('terser-webpack-plugin');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const smp = new SpeedMeasurePlugin();
module.exports = smp.wrap({
plugins: [new TerserPlugin()],
});
TypeError: Cannot read property 'JavascriptModulesPlugin' of undefined
at Proxy.<anonymous> (/my-app/node_modules/terser-webpack-plugin/dist/index.js:572:49)
at /my-app/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19
at _next25 (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:42:1)
at _next3 (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:95:1)
at Hook.eval [as call] (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:105:1)
at Hook.CALL_DELEGATE [as _call] (/my-app/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/my-app/node_modules/webpack/lib/Compiler.js:993:26)
at /my-app/node_modules/webpack/lib/Compiler.js:1035:29
at Hook.eval [as callAsync] (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/my-app/node_modules/tapable/lib/Hook.js:18:14)
Plugin: "compression-webpack-plugin": "7.1.2"
Simple config to reproduce:
const CompressionPlugin = require('compression-webpack-plugin');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const smp = new SpeedMeasurePlugin();
module.exports = smp.wrap({
plugins: [new CompressionPlugin()],
});
TypeError: Cannot read property 'PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER' of undefined
at Proxy.<anonymous> (/my-app/node_modules/compression-webpack-plugin/dist/index.js:285:45)
at /my-app/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19
at Hook.eval [as call] (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:5:1)
at Hook.CALL_DELEGATE [as _call] (/my-app/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/my-app/node_modules/webpack/lib/Compiler.js:992:30)
at /my-app/node_modules/webpack/lib/Compiler.js:1035:29
at Hook.eval [as callAsync] (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/my-app/node_modules/tapable/lib/Hook.js:18:14)
at Compiler.compile (/my-app/node_modules/webpack/lib/Compiler.js:1030:28)
at /my-app/node_modules/webpack/lib/Compiler.js:473:12
Also I noticed similar problems in #155 and #149 with html-webpack-plugin
, favicons-webpack-plugin
, and copy-webpack-plugin
Could anybody explain, on what side we should fix it?
Here in speed-measure-webpack-plugin?
Or it's better to create issues in these plugins' repos and fix it there?
Having the same issue with copy-webpack-plugin
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'PROCESS_ASSETS_STAGE_ADDITIONS' of undefined
mini-css-extract-plugin@1.3.9
(1.3.6 was fine)
TypeError: Class extends value undefined is not a constructor or null
because webpack.Module
is undefined
Yep, same issue with terser-webpack-plugin@5.1.1
and mini-css-extract-plugin@1.3.9
.
Same issue with html-webpack-plugin@5.3.1
:
const HtmlWebpackPlugin = require("html-webpack-plugin")
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin")
const smp = new SpeedMeasurePlugin()
module.exports = smp.wrap({
plugins: [
new HtmlWebpackPlugin(),
],
})
(node:34911) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
(Use `node --trace-deprecation ...` to show where the warning was created)
[webpack-cli] TypeError: Cannot read property 'PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE' of undefined
at Proxy.<anonymous> (/…/node_modules/html-webpack-plugin/index.js:222:31)
at /…/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19
at Hook.eval (eval at create (/…/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:25:1)
at Hook.CALL_DELEGATE [as _call] (/…/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/…/node_modules/webpack/lib/Compiler.js:992:30)
at /…/node_modules/webpack/lib/Compiler.js:1035:29
at Hook.eval [as callAsync] (eval at create (/…/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/…/node_modules/tapable/lib/Hook.js:18:14)
at Compiler.compile (/…/node_modules/webpack/lib/Compiler.js:1030:28)
at /…/node_modules/webpack/lib/Compiler.js:473:12
And with favicons-webpack-plugin@5.0.2
. The error is different though (PROCESS_ASSETS_STAGE_ADDITIONS
instead of PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
):
(node:35340) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
(Use `node --trace-deprecation ...` to show where the warning was created)
[webpack-cli] TypeError: Cannot read property 'PROCESS_ASSETS_STAGE_ADDITIONS' of undefined
at Proxy.<anonymous> (/…/node_modules/favicons-webpack-plugin/src/index.js:249:30)
at /…/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19
at Hook.eval (eval at create (/…/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:25:1)
at Hook.CALL_DELEGATE [as _call] (/…/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/…/node_modules/webpack/lib/Compiler.js:992:30)
at /…/node_modules/webpack/lib/Compiler.js:1035:29
at Hook.eval [as callAsync] (eval at create (/…/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/…/node_modules/tapable/lib/Hook.js:18:14)
at Compiler.compile (/…/node_modules/webpack/lib/Compiler.js:1030:28)
at /…/node_modules/webpack/lib/Compiler.js:473:12
We found that this plugin is incompatible with html-inline-script-webpack-plugin, but only when used with webpack-dev-server. I left some debug notes here