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

ng serve: The filename hash for Shared Workers changes on every rebuild, which constantly breaks the debugging session.

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
angular, typescript
领域
build-system, cli

调研方向

首先,使用链接的 ng-test-shared-worker 示例通过 ng serve 重现问题,然后跟踪开发服务器在重建期间对 worker 文件名进行哈希处理的过程。当 Shared Worker 的文件名在代码更改后仍保持稳定,从而不需要重新打开浏览器调试会话和断点时,即表示完成。

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

描述

angular/build:application area: @angular/build freq1: low severity2: inconvenient type: bug/fix
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 developing an Angular application that uses a Shared Worker, the ng serve development server recompiles the worker file with a new content hash in its filename upon every code change
E.g.

ng serve
Initial chunk files | Names | Raw size
main.js | main | 7.00 kB |
styles.css | styles | 96 bytes |
Lazy chunk files | Names | Raw size
worker-GFCRGYH3.js | shared-worker | 405 bytes |
Application bundle generation complete. [1.497 seconds]

Page reload sent to client(s).
Initial chunk files | Names | Raw size
main.js | main | 7.00 kB |
Lazy chunk files | Names | Raw size
worker-4KFG4YB2.js | shared-worker | 404 bytes |

This behavior forces any developer debugging the worker via browser tools (like chrome://inspect/#workers or Edge's equivalent) to manually close the detached debugger and re-open a new inspector for the newly named worker file after every single save.
This makes the development and debugging workflow for Shared Workers extremely tedious and inefficient, as it's impossible to maintain a persistent debugging session with breakpoints.
This issue is specific to the development server's file hashing strategy. For comparison, when using a custom Webpack configuration, it's possible to configure the output filename for workers to remain constant during development, which provides a seamless debugging experience. The default Angular CLI behavior should strive for a similar developer experience.

Problem exist in angular from v17+ with esbuilder

Example of application: https://github.com/mkapinos/ng-test-shared-worker

Minimal Reproduction

git clone https://github.com/mkapinos/ng-test-shared-worker
npm i
npm start

open console for shared worker... change something in code

Exception or Error

Your Environment
@angular-devkit/architect    0.2000.1
@angular-devkit/core         20.0.1
@angular-devkit/schematics   20.0.1
@angular/build               20.0.1
@angular/cli                 20.0.1
@schematics/angular          20.0.1
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.1
Anything else relevant?

No response

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

贡献指南

打开贡献指南

从这里开始

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

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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