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

[v4] Fingerprinting the output html file name with a hash determined by the html contents conflicts with webpack's contenthash variable #1033

Closed
pegiadise opened this issue Aug 27, 2018 · 2 comments

Comments

@pegiadise
Copy link

pegiadise commented Aug 27, 2018

Expected behaviour

It should fingerprint the output html file name with a hash determined by the html contents after the scripts have been injected

Current behaviour

Webpack throws error:

UnhandledPromiseRejectionWarning: Error: Path variable [contenthash] not implemented in this context: html/app.[contenthash].html

Environment

node: v8.11.2
npm: v5.6
yarn: v1.9.2
webpack@4.17.1
html-webpack-plugin@4.0.0-alpha

Config

module.exports = {
  ...,
  plugins: [
    new HtmlWebpackPlugin(
      template: './app/assets/html/app.html',
      chunks: ['app-bundle', 'vendor~app-bundle'],
      filename: IS_DEV ? 'index.html' : 'html/app.[contenthash].html'
    ...
  ]
}

Similar issues

There was a similar behaviour from extract-text-webpack-plugin in the past when webpack-4 introduced this internally in version 4.3.0:

webpack-contrib/extract-text-webpack-plugin#763

@pegiadise pegiadise changed the title [v4] [v4] Fingerprinting the output html file name with a hash determined by the html contents conflicts with webpack's contenthash variable Aug 27, 2018
@jantimon
Copy link
Owner

Do you have any idea how we might fix that?

@pegiadise
Copy link
Author

The simplest approach would be my PR which does nothing else but renaming the key there. However, it is up to you for the long term solution. Thanks for the awesome plugin! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants