Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Adjust hashes used in production asset filenames #930

Merged
merged 1 commit into from
Jun 6, 2018
Merged

Adjust hashes used in production asset filenames #930

merged 1 commit into from
Jun 6, 2018

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Jun 5, 2018

  • Switches from [chunkhash] to [contenthash] to prevent unnecessary cache-busting of JS files when only extracted CSS has changed.
  • Limits all hashes to 8 characters to make build console output more readable, and for parity with CRA/vue-cli. (By default [hash] gives a 32 character hash, and [{chunk,content}hash] 20 characters.)
  • Removes unnecessary hashing in chunkFilename for the node preset (since generated assets won't be cached regardless).

See:
https://webpack.js.org/configuration/output/#output-filename
https://webpack.js.org/configuration/output/#output-chunkfilename
https://github.com/webpack/webpack/blob/v4.11.0/lib/WebpackOptionsDefaulter.js#L91-L104
(Note the docs are out of date: webpack/webpack.js.org#2221)

Fixes #844.

* Switches from `[chunkhash]` to `[contenthash]` to prevent unnecessary
  cache-busting of JS files when only extracted CSS has changed.
* Limits all hashes to 8 characters to make build console output
  more readable, and for parity with CRA/vue-cli.
* Removes unnecessary hashing in `chunkFilename` for the node preset
  (since generated assets won't be cached regardless).

Fixes #844.
@edmorley edmorley added this to the v9 milestone Jun 5, 2018
@edmorley edmorley self-assigned this Jun 5, 2018
@edmorley edmorley requested a review from eliperelman June 5, 2018 23:12
Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, and good catch on the outdated docs.

@edmorley edmorley merged commit 850d743 into neutrinojs:master Jun 6, 2018
@edmorley edmorley deleted the adjust-filename-hashes branch June 6, 2018 14:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

2 participants