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

オープン
#30,494 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
176

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。