ng g module with route option not working with the new provideRouter
- 主要语言
- TypeScript
- 星标
- 27k
- 派生
- 11.8k
- 平均合并
- 14 小时 23 分钟
- 30 天内合并 PR
- 162
描述
### Command
generate
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
when using the new way `provideRouter` the command `ng g m foo --route=foo -m=app` stop working
### Minimal Reproduction
create new angular 15 project
in `app-routing.module.ts`
1. remove `AppRoutingModule`
2. export the `routes` const
in `app.module.ts`
1. remove `AppRoutingModule` from `import` array
2. add `provideRouter(routes)` to the `providers` array
then in the command line run `ng g m foo --route=foo -m=app`
### Exception or Error
```text
Couldn't find a route declaration in /src/app/app-routing.module.ts.
Use the '--module' option to specify a different routing module.
```
### Your Environment
```text
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1500.5
@angular-devkit/build-angular 15.0.5
@angular-devkit/core 15.0.5
@angular-devkit/schematics 15.0.5
@angular/cli 15.0.5
@schematics/angular 15.0.5
rxjs 7.5.7
typescript 4.8.4
```
### Anything else relevant?
changing the file name from `app-routing.module.ts` to `routes.ts` gives a different but similar error message
```
Couldn't find a route declaration in /src/app/app.module.ts.
Use the '--module' option to specify a different routing module.
```
贡献指南
调研方向
在使用 `provideRouter` 的 Angular 15 项目中复现 `ng g m foo --route=foo -m=app`,然后对照 `app-routing.module.ts` 和 `app.module.ts` 检查模块生成中的路由处理。完成标准是:该命令能够找到导出的路由声明,并在没有所示错误的情况下生成包含请求路由的模块。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- cli, tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100