angular / angular/angular-cli

Angular 18 production build doesn't work with vendor source maps

オープン
#28,426 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る
angular/build:application area: @angular/build freq1: low severity3: broken type: bug/fix
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### Which @angular/* package(s) are the source of the bug?

compiler-cli

### Is this a regression?

Yes

### Description

We upgraded our apps from ng17 to 18 and adopted the new build system. In our angular.json file we had options set to enable vendor source maps for production and regular builds. This worked fine prior to the upgrade. Example config below for references as I cannot post details from our work setup.

```json
{
"projects": {
"your-project-name": {
"architect": {
"build": {
"options": {
"sourceMap": {
"scripts": true,
"vendor": true
}
}
}
}
}
}
}
```

So when running ng serve with a production config the source maps for things like RX are debuggable without issue.

```
ng serve application --open live-reload --configuration=production
```

However when we run our release jobs using this command we find the disted app does not support loading source maps from node_modules. All other source maps seem to work fine .

```
ng build application --configuration=production
```

I looked for a documented change here to see if vendor source maps are still supported in production builds and couldn't find anything about them being deprecated.

### Please provide a link to a minimal reproduction of the bug

_No response_

### Please provide the exception or error you saw

```true
404 cannot load source map
```

### Please provide the environment you discovered this bug in (run `ng version`)

```true
Angular CLI Version: 18.1.1
Node Version: 20.11.1
Package Manager: npm 10.2.4
Operating System: win32 x64 (Windows 64-bit)

@angular-devkit/architect: 0.1801.1
@angular-devkit/build-angular: 18.1.1
@angular-devkit/core: 18.1.1
@angular-devkit/schematics: 18.1.1
@schematics/angular: 18.1.1
ng-packagr: 18.1.0
rxjs: 7.8.1
typescript: 5.5.4
webpack: 5.92.1
zone.js: 0.14.3
```

### Anything else?

_No response_

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

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

調査の方向性

angular.json の sourceMap 設定から始め、ドキュメントに記載された ng serve コマンドと、production 構成を使用する ng build コマンドの出力を比較します。Angular CLI 18.1.1 で vendor source maps の 404 を再現し、その後 production build の経路を追跡して node_modules の map が省略される理由を特定します。完了条件は、production build で vendor source maps が読み込まれ、他の source maps も引き続き機能することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript, webpack
領域
build-system
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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