Skip to content

Replace hash with contenthash.#71

Open
jameseaster wants to merge 1 commit into
mainfrom
deprecation-fix
Open

Replace hash with contenthash.#71
jameseaster wants to merge 1 commit into
mainfrom
deprecation-fix

Conversation

@jameseaster

Copy link
Copy Markdown

Fix: Replace deprecated [hash] with [contenthash] in webpack output filename


Summary

Webpack 5 deprecated the [hash] template variable for output filenames. It emits this deprecation warning when the variable is encountered:

[DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH] DeprecationWarning:
[hash] is now [fullhash] (also consider using [chunkhash] or [contenthash])

The direct rename is [hash] → [fullhash], but webpack's [contenthash] might be the better choice for output filenames because it only changes when that file's content changes — giving downstream consumers better cache behavior. [fullhash] changes on every build regardless of content.

This is a patch update:

  • Fixes a deprecation warning emitted by webpack 5
  • Does not alter the public API of this package
  • Produces the same filename structure ([name]..js), just with a more stable hash algorithm
  • No consumer code changes required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant