Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
When an NgModule is imported with an as alias, it is not added to the component imports array when converting to standalone
Steps to reproduce:
gh repo clone mattlewis92/standalone-migration-bug
cd standalone-migration-bug
npm i
ng generate @angular/core:standalone --mode=convert-to-standalone --path=./src/app/foo
Outputs this, where the LegacyModule2 is not added to the imports array of FooComponent
import { Component, NgModule } from '@angular/core';
import { LegacyModule } from '../legacy/legacy1'
import { LegacyModule as LegacyModule2 } from '../legacy/legacy2'
@Component({
selector: 'foo',
template: '<legacy1 /> <legacy2 />',
imports: [LegacyModule] // <-- LegacyModule2 should be imported here
})
export class FooComponent {}
@NgModule({
imports: [LegacyModule, LegacyModule2, FooComponent],
exports: [FooComponent]
})
export class FooModule {}
Please provide a link to a minimal reproduction of the bug
https://github.com/mattlewis92/standalone-migration-bug
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 20.3.2
Node: 22.14.0
Package Manager: npm 10.9.2
OS: darwin arm64
Angular: 20.3.1
... common, compiler, compiler-cli, core, forms
... platform-browser, router
Package Version
------------------------------------
@angular-devkit/architect 0.2003.2
@angular-devkit/core 20.3.2
@angular-devkit/schematics 20.3.2
@angular/build 20.3.2
@angular/cli 20.3.2
@schematics/angular 20.3.2
rxjs 7.8.2
typescript 5.9.2
zone.js 0.15.1
Anything else?
No response
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
When an NgModule is imported with an
asalias, it is not added to the component imports array when converting to standaloneSteps to reproduce:
Outputs this, where the
LegacyModule2is not added to theimportsarray ofFooComponentPlease provide a link to a minimal reproduction of the bug
https://github.com/mattlewis92/standalone-migration-bug
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
No response