Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

application builder's dev-server doesn't work with imports of html files from ts

未关闭
#34,166 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript, vite, webpack

调研方向

Start with the StackBlitz reproduction and src/main.ts, then trace the application builder's serve handling for the configured .html file loader and compare it with the working SVG case and ng build output. Done means the serve command returns test.html's contents instead of index.html, while the existing SVG behavior remains working.

由索引模型根据 Issue 内容生成。

描述

area: @angular/build gemini-triaged
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

When configuring a file loader for .html, the asset doesn't seem to get added to the list of files served by vite. This does work with ng build, as well as with the webpack builder's serve function, as well as with other filetypes (svg in the demo below).

Minimal Reproduction

https://stackblitz.com/edit/stackblitz-starters-ejbbdzyh?file=src%2Fmain.ts

See that the clicking on the SVG works fine (you get a giant purple square), but when clicking on the HTML link instead of the test file's contents you get what is, effectively, index.html. However if you do a ng build, the test.html will end up properly in the target directory.

Exception or Error
Request for HTML file "/media/test.html" was received but no asset found. Asset may be missing from build.
Your Environment
Angular CLI       : 22.2.0
Angular           : 22.2.0
Node.js           : 22.22.3
Package Manager   : npm 10.8.2
Operating System  : linux x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 22.2.0            │ ^22.2.0           │
│ @angular/cli              │ 22.2.0            │ ^22.2.0           │
│ @angular/common           │ 22.2.0            │ ^22.2.0           │
│ @angular/compiler         │ 22.2.0            │ ^22.2.0           │
│ @angular/compiler-cli     │ 22.2.0            │ ^22.2.0           │
│ @angular/core             │ 22.2.0            │ ^22.2.0           │
│ @angular/forms            │ 22.2.0            │ ^22.2.0           │
│ @angular/platform-browser │ 22.2.0            │ ^22.2.0           │
│ @angular/router           │ 22.2.0            │ ^22.2.0           │
│ rxjs                      │ 7.8.2             │ ^7.8.1            │
│ typescript                │ 6.0.3             │ ^6.0.3            │
│ zone.js                   │ 0.16.1            │ ^0.16.1           │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?

No response

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
20 小时 47 分钟
30 天内合并 PR
178

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。