speed-measure-webpack-plugin
speed-measure-webpack-plugin copied to clipboard
Breaks with incremental builds
Several plugins I have tried to use alongside this plugin break when webpack starts an incremental build after a code change. The issue seems to be that all the hooks registered on the webpack 4 compiler.hooks object are missing in the incremental compile. The plugins then fail with errors like TypeError: Cannot read property 'call' of undefined. Removing the speed-measure-webpack-plugin fixes the issue.
Hey @mcintyret - which plugins are you using that seem to be failing?
Thanks for raising :)
I saw the issue with both hard-source-webpack-plugin and fork-ts-checker-webpack-plugin
Okay cool, thanks. I'll try my best to get some time this week to have a look at those and see why they're having issues :thinking:
Break incremental builds too:
content: childCompilation.assets[outputName].source()
^
TypeError: Cannot read property 'source' of undefined```
`[email protected]`
@stephencookdev I really like this plugin any progress on this? Any pointers to look at for fixing this?
So the issue of childCompilation.assets[outputName].source() I believe might actually be a separate root issue...
But the issue of the compiler.hooks missing, has 2 possible causes
Either, this wrapHooks call is returning something stupid.
Or, compiler itself isn't being wrapped correctly, so it's not actually a proxy that hits that wrapHooks function as we would expect.
Longer term, I really want to expand our integration tests to be able to check incremental builds, as well as just plain builds. It makes testing + fixing issues a lot easier, if nothing else...
Unfortunately I'm really struggling to find time to work on this repo at the moment! Any help would be massively appreciated :pray: I'll try my best to write up a decent CONTRIBUTING.md in the next couple of days
Similar issue with [email protected], [email protected]:
My manifest options are set as follows:
new ManifestPlugin({
seed: {}, // TODO: remove after upgrading to v3: https://github.com/danethurber/webpack-manifest-plugin/issues/144
fileName: 'client-script-manifest.json',
writeToFileEmit: true, // always write a manifest.json file, even with webpack-dev-server
publicPath: ''
}),
And getting the following err after the first build:
95% emitting ManifestPlugin✖ 「wdm」: TypeError: Cannot read property 'call' of undefined
at ManifestPlugin.<anonymous> (/Users/chandoka/Documents/[REDCATED]/application/node_modules/webpack-manifest-plugin/lib/plugin.js:191:53)
at args (/Users/chandoka/Documents/[REDCATED]/application/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/chandoka/Documents/[REDCATED]/application/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:16:1)
at Compiler.emitAssets (/Users/chandoka/Documents/[REDCATED]/application/node_modules/webpack/lib/Compiler.js:358:19)
at onCompiled (/Users/chandoka/Documents/[REDCATED]/application/node_modules/webpack/lib/Watching.js:50:19)
at hooks.afterCompile.callAsync.err (/Users/chandoka/Documents/[REDCATED]/application/node_modules/webpack/lib/Compiler.js:547:14)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/chandoka/Documents/[REDCATED]/application/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:15:1)
at compilation.seal.err (/Users/chandoka/Documents/[REDCATED]/application/node_modules/webpack/lib/Compiler.js:544:30)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/chandoka/Documents/[REDCATED]/application/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:10:1)
at AsyncSeriesHook.lazyCompileHook (/Users/chandoka/Documents/[REDCATED]/application/node_modules/tapable/lib/Hook.js:154:20)
Hard to reproduce such a large app but hopefully the additional logs will help debug.
I thought I would chip in here and add my 2-cents.
TypeError: Cannot read property 'call' of undefined
at /var/www/glasshouse-games/Frontend/node_modules/autodll-webpack-plugin/lib/plugin.js:152:48
Is occurring for me when using SPM plugin with nextjs and a custom webpack config at next.config.js as follows:
module.exports = withCSS({
target: 'serverless',
webpack: smp.wrap((config, {}) => config),
env: { env: process.env.NODE_ENV },
})
I will keep playing and update if I get any ideas where/why it is falling over.
Is there any solution to this problem now?
I hacked this into node_modules/webpack-manifest-plugin/lib/plugin.js

if (compiler.hooks) {
if (!compiler.hooks.webpackManifestPluginAfterEmit) {
compiler.hooks.compilation.tap({
name: 'ManifestPlugin',
stage: Infinity
}, function (compilation) {
compilation.applyPluginsAsync('webpack-manifest-plugin-after-emit', manifest, compileCallback);
});
} else {
compiler.hooks.webpackManifestPluginAfterEmit.call(manifest);
}
} else {
compilation.applyPluginsAsync('webpack-manifest-plugin-after-emit', manifest, compileCallback);
}
Is there any update on this issue? I am also facing the same issue with ts-fork plugin.