Repository navigation
fix(build): use stable module ids in chunk import map hash signatures (fix #23975) - #23976
Merged
sapphi-red merged 7 commits intoNov 4, 2026
Merged
sapphi-red merged 7 commits into
sapphi-red merged 7 commits into
Conversation
β¦ folder Builds the same project from two folders and expects identical output file names. Fails today because chunk import map preload signatures include absolute module ids. Refs vitejs#23975 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix vitejs#23975 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
CI looks to be failing on unrelated changes to mine as far as I can tell! |
mandyheg
marked this pull request as ready for review
November 2, 2026 14:03
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agammann
reviewed
Nov 4, 2026
agammann
left a comment
There was a problem hiding this comment.
The new normalization still includes the build folder when Vite is called with root from a fixed process directory and rolldownOptions.cwd is unset. In that ordinary programmatic case, path.relative(process.cwd(), /build-A/src/entry.js) and the same module in /build-B differ, so the facade/module signatures (and chunk hashes) change across releases. The new integration test sets rolldownOptions.cwd: root explicitly, which hides this case. Could the default normalization base use the resolved Vite root, and could the test exercise build({ root }) without setting Rolldown cwd?
sapphi-red
approved these changes
Nov 4, 2026
Contributor
Author
|
Thanks for the cleanup and merge @sapphi-red! |
Merged
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23975
The bug:
The import map preload signatures feed absolute file paths into chunk hashes. This means the same code built from two different folders gets different chunk file names.
We build each release of our app in different folders and this prevents us from maximising what the browser caches.
The fix: use paths relative to Rolldown's cwd (
rolldownOptions.cwd), falling back toprocess.cwd(). This is how Rolldown builds its own import map keys. Each id also keeps a file/non-file flag so a file and a virtual module with the same name can't collide (see rolldown/rolldown#11277 (comment)).AI disclosure: I used Claude, but have reviewed the proposed solution and code myself.