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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use contenthash instead of hash #1331

Closed
pseudo-su opened this issue Jun 11, 2020 · 2 comments
Closed

Use contenthash instead of hash #1331

pseudo-su opened this issue Jun 11, 2020 · 2 comments

Comments

@pseudo-su
Copy link
Contributor

馃殌 Feature request: [contenthash] instead of [hash]

I think it should be possible to change the [hash:8] in file-loader to use [contenthash:8] which should mean that if you don't make changes to a file it wouldn't get a new hash when you rebuild.

https://github.com/jaredpalmer/razzle/blob/master/packages/razzle/config/createConfig.js#L159

Current Behavior

Using [hash:8] would mean a per-build hash is used on the file so every build/deploy would invalidate the cache those media resources.

Desired Behavior

Using [contenthash:8] should make it a stable filename across builds as long as the content of the file doesn't change, meaning you can have longer lived caching on static files.

Additional context

My initial thought was that this could also be applied to url-loader as well https://github.com/jaredpalmer/razzle/blob/master/packages/razzle/config/createConfig.js#L171

But I'm a bit confused at the config here because it seems like it's passing options to url-loader that it doesn't support. emitFile and name don't seem to be valid options https://webpack.js.org/loaders/url-loader/

Should url-loader be specifying a fallback to file-loader instead? I'm not exactly sure without spending more time investigating

@fivethreeo
Copy link
Collaborator

I鈥檓 not quite sure about this either. Did url loader change maybe? I need to investigate too. 馃

@fivethreeo
Copy link
Collaborator

fixed in dev

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

No branches or pull requests

2 participants