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

Rename contenthash to hashByContent to resolve internal webpack conflict #1034

Closed
wants to merge 1 commit into from
Closed

Rename contenthash to hashByContent to resolve internal webpack conflict #1034

wants to merge 1 commit into from

Conversation

pegiadise
Copy link

This occurs with webpack >= 4.3 because they internally added a [contentHash] variable. The simplest way around it is to rename the key to something else which is what I did here. I needed a quick fix for it, but I also stand by the choice of choosing a different key there because:

  1. more declarative as to what it is doing
  2. treating webpack internal variables as a black box

Closes #1033

Also updates the test case and comments. This occurs with webpack >= 4.3
@jantimon
Copy link
Owner

Wouldn't it be better to keep [contenthash] and tell webpack to ignore it instead of coming up with our own new syntax?

@pegiadise
Copy link
Author

pegiadise commented Aug 27, 2018

Maybe you are right. I took a look at mini-css-extract-plugin way of doing it, but you might be more familiar with tapping into compilation hooks. Also it would probably require bumping webpack to a higher version and I don't know if there are any restrictions right now holding you there.

@jantimon
Copy link
Owner

Would it work to replace [contenthash] to [html-webpack-plugin-contenthash] during startup and change

const finalOutputName = childCompilationOutputName.replace(/\[(?:(\w+):)?contenthash(?::([a-z]+\d*))?(?::(\d+))?\]/ig, (_, hashType, digestType, maxLength) => {
to html-webpack-plugin-contenthash?

@sibiraj-s
Copy link
Contributor

sibiraj-s commented Oct 1, 2018

how about templatehash? Since the plugin generates hashes from a template

@pegiadise
Copy link
Author

@sibiraj-s [templatehash] sounds like a good alternative but I think the maintainer wants to keep the [contenthash] in order to generally comply with webpack API. @jantimon I 'll give your proposal a try tonight and get back to you.

@sibiraj-s
Copy link
Contributor

but I think the maintainer wants to keep the [contenthash] in order to generally comply with webpack API.

hi @pegiadise . You are correct. Can you check #1065 before you work on something? I tried to preserve both contenthash and templatehash

@jantimon
Copy link
Owner

jantimon commented Oct 3, 2018

Moved to #1065

@jantimon jantimon closed this Oct 3, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Nov 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants