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

Đang mở
#30,494 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, typescript
Lĩnh vực
build-system, cli

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện vấn đề với ng serve bằng ví dụ ng-test-shared-worker được liên kết, sau đó theo dõi việc băm tên tệp của worker trong development server trong các lần rebuild. Hoàn thành khi tên tệp của Shared Worker vẫn ổn định qua các thay đổi mã, để không cần mở lại các phiên gỡ lỗi của trình duyệt và các breakpoint.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
16 giờ 35 phút
Pull request đã merge (30 ngày)
176

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/angular-cli

Tất cả issue của angular/angular-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.