Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks with incremental builds #44

Open
mcintyret opened this issue May 31, 2018 · 11 comments · May be fixed by #169
Open

Breaks with incremental builds #44

mcintyret opened this issue May 31, 2018 · 11 comments · May be fixed by #169

Comments

@mcintyret
Copy link

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.

@stephencookdev
Copy link
Owner

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

Thanks for raising :)

@mcintyret
Copy link
Author

mcintyret commented Jun 2, 2018

I saw the issue with both hard-source-webpack-plugin and fork-ts-checker-webpack-plugin

@stephencookdev
Copy link
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
Copy link

Break incremental builds too:

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

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

`html-webpack-plugin@2.30.1`

@Nilos
Copy link

Nilos commented Oct 9, 2018

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

@stephencookdev
Copy link
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
Copy link

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
Copy link

hutber commented Nov 24, 2019

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
Copy link

xccjk commented Nov 13, 2020

Is there any solution to this problem now?

@BLamy
Copy link

BLamy commented Jun 22, 2021

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
Copy link

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants