fix(vite): handle Vite query strings in linker transform filter#177
Merged
Brooooooklyn merged 3 commits intovoidzero-dev:mainfrom Mar 27, 2026
Merged
Conversation
The linker plugin's transform filter regex used a `$` anchor that prevented matching module IDs with Vite-appended query strings (e.g. `?v=df7b0864`). When Angular packages are not pre-bundled (excluded from optimizeDeps, SSR mode, etc.), Vite serves their files through the transform pipeline with these query strings, causing the linker to miss them entirely. This left `ɵɵngDeclare*` calls unlinked, triggering JIT fallback errors at runtime. Also adds `[\\/]` for cross-platform path separator support, consistent with the existing `SKIP_REGEX`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace tests that read from the e2e app's @angular/common installation with self-contained inline fixtures using minimal partial declarations. This removes the fragile dependency on a specific Angular version being installed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
formatting issue fixed |
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.
Summary
NODE_MODULES_JS_REGEXin the linker plugin to handle Vite-appended query strings (?v=...) in module IDs[\\/]for cross-platform path separator supportProblem
When Angular packages are not pre-bundled (excluded from
optimizeDeps, SSR mode, etc.), Vite serves their files through the transform pipeline and appends query strings to module IDs (e.g.,common.mjs?v=df7b0864). The linker's$anchor inNODE_MODULES_JS_REGEXprevented matching these IDs, so the linker never ran — leavingɵɵngDeclare*calls unlinked and causing JIT fallback errors at runtime:This is especially impactful with Angular 21+ which splits FESM bundles into chunk files (e.g.,
_platform_location-chunk.mjs), as these chunks may not be included in the same pre-bundle as the main entry.Fix
Test plan
linker.test.tswith 12 tests covering:_platform_location-chunk.mjs,_location-chunk.mjs,_common_module-chunk.mjs, etc.)ɵɵngDeclarecalls (was 6 before fix)