Skip to content

fix(vite): include no-result transform hooks in module timings - #599

Merged
webfansplz merged 1 commit into
vitejs:mainfrom
SaKaNa-Y:fix/vite-no-result-transform-timing
Oct 9, 2026
Merged

webfansplz merged 1 commit into
vitejs:mainfrom
SaKaNa-Y:fix/vite-no-result-transform-timing

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

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, a plugin can appear cheaper than its recorded calls. A transform hook can spend time on a module and return undefined or null to keep the input code. Plugin details record that time, but the module summary filters out transforms without a code result.

Include all recorded transforms in the module summary. This preserves the existing code results and module sizes while counting the time spent in hooks that return no code.

Related fixes: #606 includes timings from load hooks that return no code. #607 includes timings from successful resolveId calls that return the input ID. Each PR targets main and can be reviewed and merged independently.

Validation on this branch:

  • The regression cases fail for undefined and null with the old aggregation. They pass with this change. Unchanged code, changed code, and an empty string also pass.
  • pnpm test --run: 52 files passed, 356 tests passed, 2 skipped.
  • pnpm lint, pnpm typecheck, and pnpm build passed.

@pkg-pr-new

pkg-pr-new Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@599

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@599

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@599

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@599

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@599

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@599

commit: 406dc44

@SaKaNa-Y SaKaNa-Y changed the title fix(vite): count transforms without results in module timings fix(vite): include omitted hook calls in module timings Oct 7, 2026
@SaKaNa-Y
SaKaNa-Y force-pushed the fix/vite-no-result-transform-timing branch from 5a951f9 to 406dc44 Compare October 7, 2026 06:19
@SaKaNa-Y SaKaNa-Y changed the title fix(vite): include omitted hook calls in module timings fix(vite): count transforms without results in module timings Oct 7, 2026
@SaKaNa-Y
SaKaNa-Y marked this pull request as ready for review October 8, 2026 08:13
@SaKaNa-Y

SaKaNa-Y commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Actually, all three PRs fix missing hook timings in specific cases.

#599 fixes the issue where time spent in transform is not included in the module summary when it returns null or undefined.

#606 fixes the issue where time spent in load is not counted when it returns null or undefined.

#607 fixes the issue where time spent in resolveId is not included in the module summary when it successfully returns the same module ID as its input.

@webfansplz webfansplz changed the title fix(vite): count transforms without results in module timings fix(vite): include no-result transform hooks in module timings Oct 9, 2026
@webfansplz
webfansplz merged commit 6e93335 into vitejs:main Oct 9, 2026
13 checks passed
@SaKaNa-Y
SaKaNa-Y deleted the fix/vite-no-result-transform-timing branch October 9, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants