Unverified Commit 0f19c983 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Compare modules' layer when tracking server CSS changes (#47927)

This PR fixes an issue reported by @feedthejim, that when we track CSS
module changes only the content hashes are compared. However the same
module can end up with totally different content in different layers,
hence this PR also adds the layer as part of the resource key so we
don't compare apples to oranges.

---------
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 29ed52b0
...@@ -946,13 +946,13 @@ export default class HotReloader { ...@@ -946,13 +946,13 @@ export default class HotReloader {
key.startsWith('app/') && key.startsWith('app/') &&
mod.resource?.endsWith('.css') mod.resource?.endsWith('.css')
) { ) {
const prevHash = prevCSSImportModuleHashes.get( const resourceKey = mod.layer + ':' + mod.resource
mod.resource const prevHash =
) prevCSSImportModuleHashes.get(resourceKey)
if (prevHash && prevHash !== hash) { if (prevHash && prevHash !== hash) {
hasCSSModuleChanges = true hasCSSModuleChanges = true
} }
prevCSSImportModuleHashes.set(mod.resource, hash) prevCSSImportModuleHashes.set(resourceKey, hash)
} }
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment