Skip to content

fix: linker uses version-aware standalone defaulting for pre-v19 libraries#90

Merged
Brooooooklyn merged 1 commit intomainfrom
fix/linker-version-aware-standalone-default
Mar 6, 2026
Merged

fix: linker uses version-aware standalone defaulting for pre-v19 libraries#90
Brooooooklyn merged 1 commit intomainfrom
fix/linker-version-aware-standalone-default

Conversation

@Brooooooklyn
Copy link
Member

@Brooooooklyn Brooooooklyn commented Mar 6, 2026

The linker unconditionally defaulted standalone to true when isStandalone
was absent from partial declarations. Angular v12–v18 libraries default to
false; only v19+ defaults to true. This caused NgModule-declared components
from older libraries (e.g. PrimeNG v12) to be incorrectly marked standalone,
breaking directive resolution (NG0303).

Add get_default_standalone_value() using the semver crate to read the
version field and return major >= 19. The special 0.0.0-PLACEHOLDER
dev sentinel also defaults to true, matching the Angular reference linker.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Note

Medium Risk
Changes code generation for linked directives/components/pipes when isStandalone is omitted, which can affect runtime behavior across many Angular libraries. Risk is mitigated by targeted semver parsing and extensive new regression tests across version ranges and edge cases.

Overview
Fixes the linker to stop defaulting standalone to true unconditionally when isStandalone is missing from partial declarations.

Adds semver-based version detection (version.major >= 19, with special handling for 0.0.0-PLACEHOLDER) and applies it to ɵɵdefineComponent, ɵɵdefineDirective, and ɵɵdefinePipe output so pre-v19 libraries default to standalone: false.

Introduces a semver dependency and adds regression tests covering v12/v18/v19+/prerelease/placeholder behavior and explicit isStandalone overrides.

Written by Cursor Bugbot for commit 404107d. This will update automatically on new commits. Configure here.

…aries

The linker unconditionally defaulted `standalone` to `true` when `isStandalone`
was absent from partial declarations. Angular v12–v18 libraries default to
`false`; only v19+ defaults to `true`. This caused NgModule-declared components
from older libraries (e.g. PrimeNG v12) to be incorrectly marked standalone,
breaking directive resolution (NG0303).

Add `get_default_standalone_value()` using the `semver` crate to read the
`version` field and return `major >= 19`. The special `0.0.0-PLACEHOLDER`
dev sentinel also defaults to `true`, matching the Angular reference linker.

- Fix #87

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Brooooooklyn Brooooooklyn merged commit d82674d into main Mar 6, 2026
4 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/linker-version-aware-standalone-default branch March 6, 2026 05:43
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.

Linker emits wrong standalone: true for pre-v19 NgModule-declared components/directives/pipes

1 participant