`ng generate application` produces a missing stylesheet when a workspace component type is configured
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- angular, typescript
- 領域
- build-system, cli
調査の方向性
Start with the application schematic and its root component templates, especially the handling of component type for the 2016 and 2025 naming styles. Reproduce with the workspace-level component default and the commands in the issue, then run the application schematic’s E2E test for this case. Done means generated root component files and stylesheet references match the 2025 names and the build succeeds; the workspace default still applies to separately generated components.
索引モデルが issue の本文から書いたものです。
説明
Hi Angular team!
I found a case where a newly generated application fails to build when the workspace has a default component type configured.
Command
generate, build
Description
With "@schematics/angular:component": { "type": "component" } in the workspace-level schematics section of angular.json, generating an application with the 2025 file naming style produces app.component.css, but the generated app.ts references ./app.css.
As a result, the application fails its first build with NG2008. Both app.ts and an extra app.component.ts are generated.
Minimal Reproduction
-
Create a workspace:
ng new component-type-repro --create-application=false --defaults --package-manager=npm --skip-git cd component-type-repro -
Add the following at the top level of
angular.json(alongsideprojects):"schematics": { "@schematics/angular:component": { "type": "component" } } -
Generate and build an application:
ng generate application demo --file-name-style-guide=2025 --style=css --ssr=false --skip-install ng build demo --configuration=development
Actual behavior
The generated files include:
projects/demo/src/app/app.ts
projects/demo/src/app/app.component.ts
projects/demo/src/app/app.component.css
There is no app.css, but app.ts contains:
styleUrl: './app.css',
Expected behavior
The root component files and their references should consistently follow the selected application naming style: app.ts, app.html, and app.css for 2025. The generated application should build successfully.
The workspace component default should still apply when generating ordinary components separately.
Exception or Error
✘ [ERROR] NG2008: Could not find stylesheet file './app.css'. [plugin angular-compiler]
projects/demo/src/app/app.ts:7:12:
7 │ styleUrl: './app.css',
╵ ~~~~~~~~~~~
Your Environment
Reproduced with the locally built CLI from main at d5035923f0e357b2526c98110125eee04b05192f, using the repository's Bazel E2E runner. Its ng version output reports:
Angular CLI : 22.3.0-next.5
Angular : 22.3.0-next.4
Node.js : 24.15.0
Package Manager : npm 12.0.2
Operating System : darwin x64
I have not established the last working version.
Anything else relevant?
- #31053 introduced the file naming style option and describes the 2025 root component filename as
app.ts. - #34450 and #34472 addressed similar inheritance of the workspace component
typein the app-shell and routed-module schematics. This report concerns the application schematic.
The application schematic explicitly sets the component type for the 2016 style, but leaves it unspecified for 2025. It appears that the workspace default is inherited during component generation while the application templates continue to use the 2025 filenames.
I have a local fix and an E2E regression test for this case and will follow up with a PR. Thanks for taking a look!
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 271
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/angular-cli のほかの issue
-
Font inlining cache is not created or reused対応中かも @nagahara-naoki が今日担当しました。 オープンarea: @angular/build
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
angular/angular-cli#34719 ·
メンテナーはふだん 1 日以内に返信
-
area: @angular/cli
難易度 3/5 半日 初心者へのやさしさ 42/100
angular/angular-cli#34716 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
angular/angular-cli#34688 ·
メンテナーはふだん 1 日以内に返信
-
area: @angular/build
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
angular/angular-cli#34674 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Tailwind CSS v4 classes in new or moved files are not picked up by ng serve until another rebuild再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンarea: @angular/build
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
angular/angular-cli#34446 ·
メンテナーはふだん 1 日以内に返信
angular/angular-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
OHDSI/Data2Evidence#3693 ·
メンテナーはふだん 3 日以内に返信
-
severity:low triage:confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Cotal-AI/Cotal#6803 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug package:workers-shared
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cloudflare/workers-sdk#16924 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug frontend priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
nooriegarg/ContribIQ#74 ·
メンテナーはふだん 1 日以内に返信
-
parse: child keys like `007`, `1e3`, `0x1f`, `-1` make the parent an empty array and hide the valueオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100