Skip to content

Commit 520f2f0

Browse files
MeAkibalan-agius4
authored andcommitted
fix(@schematics/angular): set explicit type for the module --route component
`ng generate module --route` generates a component and references it from the routing module template by its default file and class name (`./foo`, `Foo`). The component inherited the workspace `type` option, so in workspaces that set it (e.g. after updating to v20) the component was generated as `foo.component.ts` and the routing module import failed to resolve. Pass an empty `type`, as the library and app-shell schematics do. Fixes #34449
1 parent f15c8c6 commit 520f2f0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • packages/schematics/angular/module

‎packages/schematics/angular/module/index.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ const moduleSchematic: RuleFactory<ModuleOptions> = createProjectSchematic(
183183
path: options.path,
184184
project: options.project,
185185
standalone: false,
186+
// The route templates reference the component by its default file and class name, so the
187+
// component must not inherit a `type` or `exportDefault` from the workspace.
188+
type: '',
189+
exportDefault: false,
186190
};
187191

188192
return chain([

0 commit comments

Comments
 (0)