angular / angular/angular-cli

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

Đang mở
#28,426 5 bình luận 1 reaction 0 người được giao Xem trên GitHub
angular/build:application area: @angular/build freq1: low severity3: broken type: bug/fix
Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
14 giờ 23 phút
Pull request đã merge (30 ngày)
162

Mô tả

### 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_

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

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

Hướng nghiên cứu

Bắt đầu với cấu hình sourceMap trong angular.json và so sánh đầu ra của các lệnh ng serve và ng build được ghi trong tài liệu khi sử dụng cấu hình production. Tái hiện lỗi 404 đối với vendor source maps bằng Angular CLI 18.1.1, sau đó lần theo đường dẫn production build để xác định lý do các map trong node_modules bị bỏ qua. Hoàn thành khi các production build tải được vendor source maps trong khi các source maps khác vẫn tiếp tục hoạt động.

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

Đánh giá

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

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.