Skip to content

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

@pegiadise

Description

@pegiadise

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions