Closed asbjornh closed 5 years ago
I'm not sure whether this is the expected behaviour of the build hash.
This is the expected behavior.
I tried using mini-css-extract-plugin with [name].[contenthash].css
, which seems to behave as we'd like (same hash for same content, different hash for different content)
Lol, client.js
and server.js
both import app.components.js
which has an inline timestamp, resulting in a new hash for every build even when actual code content hasn't changed
I've discovered some weird things about the hashes applied to build artifacts.
Javascript files use this pattern for filenames:
'[name].[chunkhash].js'
. I would expect this to result in the same hash for consecutive builds when the files are identical. This is not the case; in fact it looks like the hash is unique for every build when the files are unchanged.Static files (
/\.(svg|png|jpg|woff2?|ttf|eot)$/
) use'[name].[hash].[ext]'
. One would assume that this is a reference to the webpack build hash. This is not the case. Every file that matches this test gets a unique hash. This hash stays the same over consecutive builds, but the hash does change when the file content does.Scss uses
'[name].[chunkhash].css'
. This results in the same hash over consecutive builds, even when the file content changes. I haven't tested enough to know whether this hash ever actually changes.I tried using
[name].[hash].css'
for scss. This resulted in the build hash being applied (yay). The build hash is unique between builds of identical files. I'm not sure whether this is the expected behaviour of the build hash.