Skip to content

Breaks with incremental builds #44

@mcintyret

Description

@mcintyret

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.

Activity

stephencookdev

stephencookdev commented on Jun 1, 2018

@stephencookdev
Owner

Hey @mcintyret - which plugins are you using that seem to be failing?

Thanks for raising :)

mcintyret

mcintyret commented on Jun 2, 2018

@mcintyret
Author
stephencookdev

stephencookdev commented on Jun 4, 2018

@stephencookdev
Owner

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 🤔

rustjson

rustjson commented on Jul 20, 2018

@rustjson

Break incremental builds too:

          content: childCompilation.assets[outputName].source()
                                                       ^

TypeError: Cannot read property 'source' of undefined```

`html-webpack-plugin@2.30.1`
Nilos

Nilos commented on Oct 9, 2018

@Nilos

@stephencookdev I really like this plugin any progress on this? Any pointers to look at for fixing this?

stephencookdev

stephencookdev commented on Oct 10, 2018

@stephencookdev
Owner

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 🙏 I'll try my best to write up a decent CONTRIBUTING.md in the next couple of days

artivilla

artivilla commented on Nov 13, 2018

@artivilla

Similar issue with webpack-manifest-plugin@2.0.4, speed-measure-webpack-plugin@1.2.3:

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.

hutber

hutber commented on Nov 24, 2019

@hutber

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.

xccjk

xccjk commented on Nov 13, 2020

@xccjk

Is there any solution to this problem now?

BLamy

BLamy commented on Jun 22, 2021

@BLamy

I hacked this into node_modules/webpack-manifest-plugin/lib/plugin.js

image

    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);
    }
techimist

techimist commented on Mar 10, 2022

@techimist

Is there any update on this issue? I am also facing the same issue with ts-fork plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @BLamy@Nilos@hutber@mcintyret@artivilla

      Issue actions

        Breaks with incremental builds · Issue #44 · stephencookdev/speed-measure-webpack-plugin