script-ext-html-webpack-plugin: Error: ScriptExtHtmlWebpackPlugin: no asset with href

Shouldn’t the plugin be looking for something within its src tag?

It happened when I tried to inline a CoffeeScript source with the name animation.coffee, which gets transpiled to animation.js and in development mode, it will get renamed to animation.js?[hash]. Giving the file the async attribute works fine with the following regex: /animation\.*/. What goes wrong here?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 18 (7 by maintainers)

Most upvoted comments

Also getting this error using the inline option.

Config is more or less:

entry: {
  // ...other bundles
  popout: path.resolve('src/popout/index.js')
}

plugins: [
  new HtmlWebpackPlugin({
    template: /* other */,
    chunks: ['bundle'],
    hash: true,
  }),
  new HtmlWebpackPlugin({
    template: path.resolve('src/popout/index.html'),
    filename: 'popout.html',
    chunks: ['popout'],
    hash: true,
  }),
  new ScriptExtHtmlWebpackPlugin({
    inline: 'popout',
    defaultAttribute: 'async',
  }),
]

May have something to do with using hash: true?

The error:

screen shot 2017-04-13 at 12 52 53 pm

@albv - thanks! I had caught that on standard attributes but not resource hints. Fixed in v1.8.3.

sorry to bother you,i got a same problem is the reason of the problem that Because you set more than two of HtmlWebpackPlugin()? 01

02

03

@DevNebulae, @echenley Sorry for the ridiculously long time to fix. Probably too late for you but this is fixed on v1.7.2.

One more thing that could give you the “no asset with href” error… If you are using output.publicPath option it must ends with /. So for example /static/ will work, /static won’t.