ng g module with route option not working with the new provideRouter
- Lenguaje dominante
- TypeScript
- Estrellas
- 27k
- Forks
- 11.8k
- Merge medio
- 14 h 23 min
- PR fusionados (30 d)
- 162
Descripción
### 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.
```
Guía de contribución
Línea de trabajo
Reproduce `ng g m foo --route=foo -m=app` en un proyecto de Angular 15 usando `provideRouter` y, después, inspecciona el manejo de rutas de la generación de módulos en comparación con `app-routing.module.ts` y `app.module.ts`. Se considera terminado cuando el comando encuentra la declaración de rutas exportada y genera el módulo con la ruta solicitada sin el error mostrado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- cli, tooling
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100