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

Could not find HTML asset #5

Closed
creage opened this issue Jun 4, 2018 · 27 comments
Closed

Could not find HTML asset #5

creage opened this issue Jun 4, 2018 · 27 comments
Labels
bug Something isn't working has fix

Comments

@creage
Copy link

creage commented Jun 4, 2018

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

@stevenfitzpatrick
Copy link

+1

1 similar comment
@lineldcosta
Copy link

+1

@developit
Copy link
Collaborator

Can someone share their HtmlWebpackPlugin() plugin configuration?

@ikhudo
Copy link

ikhudo commented Jul 25, 2018

+1

@creage
Copy link
Author

creage commented Jul 25, 2018

@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.

@prateekbh
Copy link
Contributor

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

@harrygreen
Copy link

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

@prateekbh
Copy link
Contributor

@harrygreen, any stack Trace? Which version?

@tmf
Copy link

tmf commented Nov 24, 2018

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 jantimon/html-webpack-plugin#1032.

Maybe when the 4.0.0 version will be released,

tap(compilation, 'html-webpack-plugin-after-html-processing', PLUGIN_NAME, true, (htmlPluginData, callback) => {
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.

@developit
Copy link
Collaborator

@tmf good catch, that's likely the issue.

@notnotgabriel
Copy link

+1 I'm having the same issue here

@ilanbm
Copy link

ilanbm commented Apr 30, 2019

+1 same here

@aymenbz
Copy link

aymenbz commented May 27, 2019

+1 same issue

2 similar comments
@ilanbm
Copy link

ilanbm commented Jun 3, 2019

+1 same issue

@EthianWong
Copy link

+1 same issue

@andrispraulitis
Copy link

Does this plugin require html-webpack-plugin?

@breart
Copy link

breart commented Aug 10, 2019

Did anyone fix the issue? I've tried moving it after, using the stable version, nothing worked.

@szTheory
Copy link

Still running into this bug.

@lokmanm
Copy link

lokmanm commented Sep 28, 2019

This bug is still on tried with the latest version.

@developit
Copy link
Collaborator

Looks like we'll need to make this plugin more specific to html-webpack-plugin as of v4:
https://github.com/jantimon/html-webpack-plugin#afteremit-hook

@naiyerasif
Copy link

I'm getting the same error

 Could not find HTML asset.
    at E:\web\microflash\node_modules\critters-webpack-plugin\dist\critters.js:168:39
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\web\microflash\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:10:1)
    at AsyncSeriesHook.lazyCompileHook (E:\web\microflash\node_modules\tapable\lib\Hook.js:154:20)
    at E:\web\microflash\node_modules\webpack\lib\Compilation.js:1414:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\web\microflash\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (E:\web\microflash\node_modules\tapable\lib\Hook.js:154:20)
    at E:\web\microflash\node_modules\webpack\lib\Compilation.js:1409:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\web\microflash\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (E:\web\microflash\node_modules\tapable\lib\Hook.js:154:20)
    at E:\web\microflash\node_modules\webpack\lib\Compilation.js:1405:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\web\microflash\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (E:\web\microflash\node_modules\tapable\lib\Hook.js:154:20)
    at Compilation.seal (E:\web\microflash\node_modules\webpack\lib\Compilation.js:1342:27)
    at E:\web\microflash\node_modules\webpack\lib\Compiler.js:675:18
    at E:\web\microflash\node_modules\webpack\lib\Compilation.js:1261:4
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\web\microflash\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:29:1)

with html-webpack-plugin@3.2.0 using the following configuration.

{
  minify: true,
  templateContent () {
    return createHTMLRenderer(projectConfig.htmlTemplate)({
      app: '<div id="app"></div>'
    })
  }
}

createHTMLRenderer is a function to generate the HTML from a template.

Environment
Node: 12.16.3
Webpack: 4.43.0

@dsacramone
Copy link

@naiyerasif you find a solution? Running into this now too.

@naiyerasif
Copy link

@dsacramone Unfortunately, this became a showstopper for me and I had to revert back to puppeteer for my use case. There's an open PR #52 against this issue, but not sure if it is going anywhere.

@dmnsgn
Copy link
Contributor

dmnsgn commented Jan 8, 2021

I can confirm the following PR #62 is fixing this issue for me.

@CuteShaun
Copy link

CuteShaun commented Mar 29, 2021

+1 same

Error: Could not find HTML asset.
at /app/node_modules/critters-webpack-plugin/dist/critters.js:168:39
at AsyncSeriesHook.eval [as callAsync] (<anonymous>:12:1)
at AsyncSeriesHook.lazyCompileHook (/app/node_modules/tapable/lib/Hook.js:154:20)
at hooks.optimizeChunkAssets.callAsync.err (/app/node_modules/webpack/lib/Compilation.js:1414:32)
at _promise0.then._result0 (<anonymous>:18:1)
at process._tickCallback (internal/process/next_tick.js:68:7)

webpack: 4.44.1
node: 10.13.0

@developit
Copy link
Collaborator

This has been fixed in #84 and published as critters-webpack-plugin@3.0.0.

@hjiog
Copy link

hjiog commented Apr 23, 2023

i ran into the same issue ,and my html-webpack-plugin version is 5.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has fix
Projects
None yet
Development

No branches or pull requests