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

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 Jun 5, 2018
Copy link
Member

@eliperelman eliperelman left a comment

Looks great, and good catch on the outdated docs.

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

Successfully merging this pull request may close these issues.

None yet

2 participants