Repository navigation
fix(vite): include no-result load hooks in module timings - #606
Merged
Merged
Conversation
Keep load calls without code results in separate timing records tied to the request that produces the module snapshot. Clear pending records when requests finish or modules invalidate. Preserve request identity through batched writes and replace stale code snapshots on native file-read retries so failed attempts do not pollute successful loads.
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
This was referenced Oct 7, 2026
SaKaNa-Y
marked this pull request as ready for review
October 8, 2026 08:13
webfansplz
approved these changes
Oct 9, 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.
Important
Please take a moment to read this. Thank you!
I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not merge this PR until I have added it. You may also leave this PR unaddressed (because this means I have not fulfilled my responsibilities as the author).
If my explanation is unclear or difficult to follow, please ask me to clarify or provide reproduction steps or supporting evidence.
I welcome suggestions and counterarguments, especially questions about anything I may have overlooked. (Your feedback helps me learn and improve. 🙏)
I hold myself to this standard for every PR, regardless of its size.
When investigating slow module processing in the Vite module graph, time spent in a
loadhook can disappear from the module summary. This happens when the hook returnsundefinedornulland a later plugin or Vite's file reader supplies the code. Plugin details retain the call, but the module summary only receives loads with code results.Store these load timings separately from code and include them when the module receives its source. Tie pending timings to the enclosing transform request and discard uncommitted timings when that request ends. A later request replaces the prior snapshot, including an error result from a failed load. This also applies when Vite reads a file directly and when writes share a batch. Module invalidation clears the timing data.
Related fixes: #599 includes timings from
transformhooks that return no code. #607 includes timings from successfulresolveIdcalls that return the input ID. Each PR targetsmainand can be reviewed and merged independently.Validation on this branch:
pnpm test --run: 52 files passed, 366 tests passed, 2 skipped.pnpm lint,pnpm typecheck, andpnpm buildpassed.Timings follow the enclosing transform request. This change does not define separate timing snapshots for repeated nested
this.load()calls within that request.