GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: hash initial chunks before runtime chunks by davidmurdoch · Pull Request #20711 · webpack/webpack ConversationFixes #20710 Summary
Testing
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
🦋 Changeset detectedLatest commit: f392dee The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please use integration tests, we have watchCases and hotCases, unittests are useless
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is the watch case i added okay? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| expect(currentChunkFile).not.toBe(STATE.previousChunkFile); | ||
| } | ||
|
|
||
| expect(serviceWorkerSource).toContain(currentChunkFile); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need it to compare content, it is useless too, just test shared value, also test itself without errors and warnings means that we fixed the problem
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Just use import mod from "./shared.js" and expect(mod).toBe("__SHARED__") and in the next expect(mod).toBe("__SHARED__CHANGED")
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
a simple test like:
import { sharedValue } from "./shared.js";
it("should update the runtime chunk filename map on rebuild", () => {
expect(sharedValue).toBe(
WATCH_STEP === "0" ? "__SHARED__" : "__SHARED__CHANGED"
);
});
does not catch the bug if the fix in this PR is reverted. The emitted service-worker.js content check is what actually fails before the fix and passes after.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
i've updated the test with a clarifying comment.
please feel free to edit the code yourself if you know a better way!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Merging this PR will improve performance by 25.82%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | benchmark "css-modules", scenario '{"name":"mode-production","mode":"production"}' |
8.5 MB | 6.8 MB | +25.82% |
Comparing davidmurdoch:fix/real-content-hash-watch-order (f392dee) with main (32a30c2)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes a watch-mode caching bug where runtime chunks could embed stale filename/hash references by ensuring initial chunks are hashed before runtime chunks during Compilation.createHash().
Changes:
Compilation.createHash() to hash initial chunks before runtime chunks.Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/Compilation.js | Reorders chunk hashing so non-runtime (incl. initial) chunks are hashed before runtime chunks. |
| test/watchCases/cache/stale-runtime-chunk-filename-map/webpack.config.js | Adds a dedicated watch-mode repro config with splitChunks + memory cache to exercise runtime filename mapping updates. |
| test/watchCases/cache/stale-runtime-chunk-filename-map/test.config.js | Exposes a helper to read the emitted service worker asset for runtime-reference assertions. |
| test/watchCases/cache/stale-runtime-chunk-filename-map/0/service-worker.js | Asserts that the runtime output references the current hashed shared chunk filename on each watch step. |
| test/watchCases/cache/stale-runtime-chunk-filename-map/0/offscreen.js | Provides a second entry to force a shared initial chunk used by multiple entrypoints. |
| test/watchCases/cache/stale-runtime-chunk-filename-map/0/shared.js | Baseline shared module for step 0. |
| test/watchCases/cache/stale-runtime-chunk-filename-map/1/shared.js | Modified shared module for step 1 to force a rebuild and new chunk hash/filename. |
| .changeset/public-horses-visit.md | Records the behavior change as a patch-level release note. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
/cc @xiaoxiaojx Can you take a look at this, looks like something wrong with hashes, after changing of order, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I’ll take a look — this seems a bit tricky. There’s a circular here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@xiaoxiaojx Yeah, you are right, maybe we can track circuital situations, no rush, but will be great to look at this |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oh wow. That is tricky! Feel free to close this one, I don't mind. And ping me if you want to help testing solutions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
RealContentHashPlugin watch rebuild can keep stale runtime chunk filename hashes
There was an error while loading. Please reload this page.