fix(vite-plugin-angular): skip rolldown dep optimizer transform in test mode and close transformer#2373
Conversation
…st mode and close transformer
✅ Deploy Preview for analog-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for analog-blog ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for analog-app ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds conditional test-mode skip and transformer lifecycle management to the Rolldown compiler plugin in the Vite Angular dependency optimizer. The Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks @fyvfyv! |
PR Checklist
On Vite 8 (rolldown), the dep optimizer compiler plugin runs Angular's
JavaScriptTransformerover every prebundled.js/.cjs/.mjsdependency even in test mode, and never closes the transformer's worker. The esbuild variant of the same plugin skips the transform in test mode (if (!isTest)) and closes the transformer inonEnd. Large packages inoptimizeDeps.includecan stall the optimizer before the vitest RUN banner because everything funnels through that single never-closed worker.Closes #2371
Affected scope
Recommended merge strategy for maintainer [optional]
Commit preservation note [optional]
n/a
What is the new behavior?
createRolldownCompilerPluginnow takes the sameisTestandcloseTransformerflags as the esbuild variant:loadtransform, so prebundled deps are not piped through the Babel linker — same as the esbuild path;closeTransformeris set (everything except the Astro integration), the transformer is closed inbuildEnd.JavaScriptTransformer.close()resets its lazy worker pool, so a later optimizer run re-creates it on demand.createDepOptimizerConfigpassesopts.isTestand!opts.isAstroIntegration, mirroring the esbuild call right below it.Test plan
nx format:checkpnpm build(nx build-package vite-plugin-angular, tsc, no errors)pnpm test(full workspace green;nx test vite-plugin-angular: 625 passed, 3 skipped)compiler-plugin.spec.tsfail on the old code (theloadhook was registered in test mode; nobuildEnd) and pass with the fixDoes this PR introduce a breaking change?
createRolldownCompilerPluginis internal — the package entry point only exportsangular. The only call site iscreateDepOptimizerConfig.Other information
The rest of the dep optimizer behavior on the rolldown path is unchanged.