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

Always use content hash for MiniCssExtractPlugin #2954

Merged
merged 2 commits into from
Apr 22, 2021
Merged

Always use content hash for MiniCssExtractPlugin #2954

merged 2 commits into from
Apr 22, 2021

Conversation

t27duck
Copy link
Contributor

@t27duck t27duck commented Mar 12, 2021

Closes #2928

With Javascript packs in development mode, files are outputted with
hashes in the file names so browser cache is automatically busted when
code is changed and new files are made.

However, the mini-css-extract-plugin plugin is only configured to output
files with hashes in production mode. This means that any changes to CSS
files locally will appear to not have any effect on the page you are
working on because the browser is assuming the resulting CSS file with
the same name has not changed and reloads the cached version, forcing us
to manually bust browser cache to see our changes.

This code change enables the hash-based file names for the plugin
regardless of environment.

t27duck added 2 commits March 12, 2021 17:56
With Javascript packs in development mode, files are outputted with
hashes in the file names so browser cache is automatically busted when
code is changed and new files are made.

However, the mini-css-extract-plugin plugin is only configured to output
files with hashes in production mode. This means that any changes to CSS
files locally will appear to not have any effect on the page you are
working on because the browser is assuming the resulting CSS file with
the same name has not changed and reloads the cached version, forcing us
to manually bust browser cache to see our changes.

This code change enables the hash-based file names for the plugin
regardless of environment.
@excid3
Copy link
Contributor

excid3 commented Mar 12, 2021

Hit this several times already, would be nice to have this consistent. 👍

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.

Question: Why does CSS only have contentHash in production mode? (webpacker 6)
3 participants