You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 20版本生成组件时未自动添加.component后缀的问题求助

Angular 20版本生成组件时未自动添加.component后缀的问题求助

各位Angular大佬们,求助!我最近在用Angular 20开发时碰到个棘手的问题:生成组件的时候,本该自动产出带.component后缀的文件(比如home.component.ts、home.component.html、home.component.scss),但实际只生成了home.ts、home.html、home.scss,完全没加上这个关键后缀。

我已经试过好几次重装Angular CLI,也调整过angular.json里的schematic配置,但都没解决问题。下面是我的版本信息和相关配置:

我的Angular版本:

ng version
@angular-devkit/architect 0.2000.3 (cli-only)
@angular-devkit/core 20.0.3 (cli-only)
@angular-devkit/schematics 20.0.3 (cli-only)
@schematics/angular 20.0.3 (cli-only)

angular.json中的schematics配置:

"schematics": {
  "@schematics/angular:component": {
    "style": "scss",
    "inlineStyle": false,
    "inlineTemplate": false,
    "skipTests": false
  }
}

有没有朋友遇到过类似情况?或者能给我一些排查的思路吗?万分感谢!

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 14:29:32