Template diagnostics not updated in watch mode on Windows when the type-check block is unchanged
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #34733 来自 @Matt-code-d —— 已关闭,未合并
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- angular, typescript
- 领域
- build-system, devtools
调研方向
Start with the resource invalidation check in packages/angular/build/src/tools/angular/compilation/aot-compilation.ts and the modified file handling in packages/angular/build/src/tools/esbuild/angular/source-file-cache.ts. Trace how resource dependency paths are compared during ng serve watch rebuilds on Windows, then check the existing compilation tests for coverage of that path comparison. Done means template diagnostics refresh on Windows when a template changes without changing its type-check shim, while Linux behavior remains correct.
由索引模型根据 Issue 内容生成。
描述
Command
serve
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
On Windows, during ng serve, a template edit that changes Angular diagnostics without changing the generated type-check code is not diagnosed: a stray </span> (NG5002) still ends with "Application bundle generation complete", and [attr.width.px] never shows NG8106. Linux and ng build report both correctly.
The resource check that invalidates diagnosticCache (aot-compilation.ts#L334) looks up forward-slash paths from getResourceDependencies() in modifiedFiles, which holds path.normalized backslash paths (source-file-cache.ts#L42), so it never matches on Windows:
modifiedFiles: ["C:\\repro\\src\\app\\app.html"]
resourceDependencies: ["C:/repro/src/app/app.html"]
match: false (Linux: true)
Edits that change the .ngtypecheck.ts shim are still picked up by the TypeScript builder; the others rely on this check alone. A possible fix is hostOptions.modifiedFiles.has(path.normalize(resourceDependency)).
Minimal Reproduction
Repro: https://github.com/te-gis-dev/ng-stale-template-diagnostics (node repro.mjs runs all steps against ng serve and restores the files).
With @angular/build 22.2.7, run ng serve, then:
- Append
</span>tosrc/app/app.html. ExpectedNG5002; actual on Windows: build completes, no error. - Revert, then append
<p [attr.width.px]="1"></p>. ExpectedNG8106warning; actual on Windows: none. - Add a blank line to
src/app/app.ts. The missing diagnostics appear.
| Setup | Stray </span> |
[attr.width.px] |
|---|---|---|
| 22.2.7, Windows 11, Node 26.12.1 | not reported | not reported |
22.2.7, Linux (Docker node:24) |
correct | correct |
Exception or Error
Windows:
Application bundle generation complete.
Linux:
✘ [ERROR] NG5002: Unexpected closing tag "span". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags [plugin angular-compiler]
Application bundle generation failed.
Your Environment
Angular CLI : 22.2.7
Angular : 22.2.6
Node.js : 26.12.1
Package Manager : npm 11.16.0
Operating System : win32 x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.2.7 │ 22.2.7 │
│ @angular/cli │ 22.2.7 │ 22.2.7 │
│ @angular/common │ 22.2.6 │ 22.2.6 │
│ @angular/compiler │ 22.2.6 │ 22.2.6 │
│ @angular/compiler-cli │ 22.2.6 │ 22.2.6 │
│ @angular/core │ 22.2.6 │ 22.2.6 │
│ @angular/forms │ 22.2.6 │ 22.2.6 │
│ @angular/platform-browser │ 22.2.6 │ 22.2.6 │
│ @angular/router │ 22.2.6 │ 22.2.6 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 6.0.3 │ 6.0.3 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
- Windows only; drive-letter casing is not involved.
- Latent on
main/ 22.3.0-rc.0: #34173 marks the component affected through Angular's incremental compilation first, but the lookup is stillfalseon Windows. The check has never matched there since #25940. - On 22.2.x it also locks in the stale cached error fixed by #34173: while it is served, every template edit on Windows is ignored (
repro.mjssteps 1-6).
- 主要语言
- TypeScript
- 星标
- 27k
- 派生
- 11.8k
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 225
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
angular/angular-cli 的其他 Issue
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)未关闭area: @angular/build
难度 2/5 1-3 小时 新手友好度 65/100
angular/angular-cli#34764 ·
维护者通常 1 天内回复
-
ng add @angular/ssr fails with TypeError when an NgModule in the app module file has no bootstrap array可能已有人在做 @0z5a 今天认领。 未关闭area: @schematics/angular
难度 2/5 1-3 小时 新手友好度 90/100
angular/angular-cli#34761 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
angular/angular-cli#34760 ·
维护者通常 1 天内回复
-
Angular SSR can crash `AngularAppEngine` servers with a single aborted request (22.2.6 regression)可能已有人在做 @SkyZeroZx 于 1 天前认领。 未关闭area: @angular/ssr
难度 4/5 3-5 天 新手友好度 20/100
angular/angular-cli#34754 ·
维护者通常 1 天内回复
-
area: @schematics/angular
难度 3/5 1-2 天 新手友好度 74/100
angular/angular-cli#34730 ·
维护者通常 1 天内回复
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
status/need-triage
难度 2/5 1-3 小时 新手友好度 76/100
google-gemini/gemini-cli#30384 · 1 条评论 ·
维护者通常 1 天内回复
-
P2
难度 1/5 1 小时以内 新手友好度 84/100
维护者通常 1 天内回复
-
bug ready-for-human
难度 2/5 1-3 小时 新手友好度 60/100
LucasSantana-Dev/Lucky#3150 ·
维护者通常 1 天内回复
-
enhancement good first issue priority: low size: XS
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
vercel-labs/scriptc#3979 ·
维护者通常 1 天内回复