Repository navigation
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: migrationsIssues related to `ng update`/`ng generate` migrationsbugcross-cutting: standaloneIssues related to the NgModule-less worldstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
Standalone migration's prune-ng-modules doesn't update imports properly when the pruned NgModule is referenced by a standalone component.
The following code:
@Component({
standalone: true,
template: `<app-child/>`,
imports: [ChildModule]
})
class App {
}
@Component({
selector: 'app-child',
standalone: true,
template: `...`,
})
class Child {
}
@NgModule({
imports: [Child],
exports: [Child]
})
class ChildModule {}produces:
@Component({
standalone: true,
template: `<app-child/>`,
imports: []
})
class App {
}
@Component({
selector: 'app-child',
standalone: true,
template: `...`,
})
class Child {
}and breaks the app, while it should produce:
@Component({
standalone: true,
template: `<app-child/>`,
imports: [Child]
})
class App {
}
@Component({
selector: 'app-child',
standalone: true,
template: `...`,
})
class Child {
}Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 16.2.0
Node: 20.0.0 (Unsupported)
Package Manager: pnpm 8.6.2
OS: darwin x64
Angular: 16.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1602.0
@angular-devkit/build-angular 16.2.0
@angular-devkit/core 16.2.0
@angular-devkit/schematics 16.2.0
@schematics/angular 16.2.0
rxjs 7.8.0
typescript 5.1.3
zone.js 0.13.0
Anything else?
No response
Reacted by Taras Petruk, Elvis Begovic and Sebastian Podgajny
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: migrationsIssues related to `ng update`/`ng generate` migrationsbugcross-cutting: standaloneIssues related to the NgModule-less worldstate: has PR
Activity
SuneRadich commentedon Sep 22, 2023
I am seeing something similar.
Tough my setup is different. I run a monorepo powered by nx (nx.dev). I am in the process of converting our libraries to standalone. The first step, of the generator, where I convert the internals of a library to standalone works fine. But when I run the second step (prune-ng-modules) the generator just updates and remove the module, but it does not replace the import with imports of the standalone components.
fix(migrations): replace leftover modules with their exports during p…
fix(migrations): replace leftover modules with their exports during p…
fix(migrations): replace leftover modules with their exports during p…
angular-automatic-lock-bot commentedon Oct 7, 2024
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.