ng g module with route option not working with the new provideRouter

オープン
#24,497 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, typescript
領域
cli, tooling

調査の方向性

provideRouter を使用する Angular 15 プロジェクトで ng g m foo --route=foo -m=app を再現し、その後、app-routing.module.ts および app.module.ts と照らし合わせて、モジュール生成時のルート処理を調査します。コマンドがエクスポートされたルート宣言を見つけ、表示されたエラーなしで要求されたルートを含むモジュールを生成できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

area: @schematics/angular freq1: low severity3: broken type: bug/fix
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
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
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.
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
16時間 35分
マージ済み PR(30日)
176

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。