critters: Could not find HTML asset

Followed usage instructions, and get this error:

Error: Could not find HTML asset.
    at C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\critters-webpack-plugin\dist\critters.js:200:39
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\Hook.js:35:21)
    at hooks.optimizeChunkAssets.callAsync.err (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\webpack\lib\Compilation.js:976:32)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\Hook.js:35:21)
    at hooks.additionalAssets.callAsync.err (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\webpack\lib\Compilation.js:971:36)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\Hook.js:35:21)
    at hooks.optimizeTree.callAsync.err (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\webpack\lib\Compilation.js:967:32)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\Hook.js:35:21)
    at Compilation.seal (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\webpack\lib\Compilation.js:904:27)
    at hooks.make.callAsync.err (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\webpack\lib\Compiler.js:494:17)
    at _done (eval at create (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:9:1)
    at _err1 (eval at create (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:32:22)
    at _addModuleChain (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\webpack\lib\Compilation.js:770:12)
    at processModuleDependencies.err (C:\TFS\WorkZone\WZC\Main\Source\client\node_modules\webpack\lib\Compilation.js:709:9)
    at process._tickCallback (internal/process/next_tick.js:61:11)

Tried with html-webpack-plugin on webpack 4.10.2 nodejs 10.3.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 21
  • Comments: 27 (3 by maintainers)

Most upvoted comments

Hi,

I ran into the same issue…

I think this is due to a change in html-webpack-plugin@next (tested with 4.0.0-beta.4): the hooks were renamed in https://github.com/jantimon/html-webpack-plugin/pull/1032.

Maybe when the 4.0.0 version will be released, https://github.com/GoogleChromeLabs/critters/blob/8e9e9c0fd2e2c482bb836ba19bce03e1aed29d02/src/index.js#L116 needs to use one of these hooks: https://github.com/jantimon/html-webpack-plugin#events (maybe afterEmit?)

Solution: revert to a stable version of html-webpack-plugin. Hope that helps.

Moving it after HtmlWebpackPlugin worked for me, but then got the more cryptic error: undefined

@developit it is very simple

new HtmlWebpackPlugin({
    filename: 'index.html',
    template: '../index.html',
    chunksSortMode: 'none'
})

and index.html has just <head> and <body> tags in it.

What worked for me was the order of plugins in the plugins array. Putting crittersplugin after htmlwebpackplugin made it work for me

Still running into this bug.

Does this plugin require html-webpack-plugin?