dev-server keeps stale code of a linked (`file:`) library after `ng-packagr --watch` rebuilds it (rebuild reported, restart required)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- angular, node.js, typescript
- 領域
- build-system, devtools
調査の方向性
Start with the linked reproduction and inspect how ng serve resolves and caches the linked library’s libreria.mjs while its source map changes. Compare the resolved file path and rebuilt bundle after ng-packagr --watch updates the library. Done means the app bundle contains and runs the new code without restarting ng serve.
索引モデルが 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
In a workspace with an application and a separate Angular library linked with a file: dependency, rebuilding the library in watch mode makes ng serve print "Application bundle generation complete", but the application bundle (main.js) still contains the previous compiled code of the library. The new code only appears after stopping and restarting ng serve.
The source map embedded in the same main.js already contains the new library source (sourcesContent), while the code is the old one. So the updated .map file seems to be re-read, but the content of libreria.mjs is reused from a previous build.
I could not determine whether this is the in-memory load cache, the file watcher, or something else.
Minimal Reproduction
Setup
-
Windows, project and library in sibling folders (
D:\...\proyecto-22andD:\...\libreria-22). -
Library built with
ng build libreria --watch --configuration development(ng-packagr). -
App
package.json:"libreria": "file:../libreria-22/dist/libreria"(npminstall-links=false, sonode_modules/libreriais a Junction tolibreria-22\dist\libreria). -
preserveSymlinksis not set (enabling it is not an option for me: the library sources then resolve under the app's folder and breakpoints in the library do not bind in VS Code). -
angular.jsonof the app:"build": { "configurations": { "development": { "optimization": false, "extractLicenses": false, "sourceMap": { "scripts": true, "styles": true, "vendor": true } } } }, "serve": { "options": { "poll": 1000, "prebundle": { "exclude": ["libreria"] } } } -
Angular CLI cache enabled (default).
Steps to reproduce
- Create the app and a library (
ng new,ng generate library libreria), and build the library once intodist/libreria. - In the app, add
"libreria": "file:../libreria-22/dist/libreria"and runnpm install. - In the library, create a service with a method containing
console.log('v1'), and call it from the app's root component. - Run
ng build libreria --watch --configuration developmentin the library, andng servein the app. - Change the log in the library service to
console.log('v2')and wait until ng-packagr finishes.
Expected: the dev-server rebuilds and the app runs v2.
Actual: the terminal prints "Application bundle generation complete" but the app still runs v1. Searching main.js shows the old code:
// ../libreria-22/dist/libreria/fesm2022/libreria.mjs
...
console.log("v1"); // old code
while the embedded source map has the new source:
sourcesContent: "... console.log('v2'); ..."
dist/libreria/fesm2022/libreria.mjs on disk does contain the new code. Stopping and restarting ng serve fixes it.
Things I tried without success
poll: 1000inserve.options(with restart).- Deleting
.angular/cacheand restarting (works until the next library change). prebundle.excludewith the package name.- Starting from a shell with the drive letter in uppercase (
D:) instead of lowercase. <remove this line if you did not launchng servefrom that shell>
Minimum Reproduction
https://github.com/LuisEscamillaMartin/repro-linked-lib-stale
Exception or Error
No error. The build reports success.
Your Environment
Angular CLI : 22.2.5
Node.js : 24.21.0
Package Manager : npm 11.19.0
Operating System : win32 x64
Anything else relevant?
Without preserveSymlinks, the library is bundled into main.js from its real path (../libreria-22/dist/libreria/fesm2022/libreria.mjs), outside node_modules.
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 225
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信