`deploy-url` is not prepended to imported file url when using `file` loader in `esbuild`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- angular, typescript
- Lĩnh vực
- build-system, cli
Hướng nghiên cứu
Bắt đầu với esbuild application builder và cách xử lý file-loader, sử dụng angular.json và lệnh được tái hiện ng build --deploy-url=/my-deploy-url/ làm các điểm bắt đầu. Kiểm tra cách tạo URL SVG được import và so sánh với hành vi deploy URL mong đợi; công việc được xem là hoàn tất khi URL của tệp được import chứa deploy URL đã cấu hình mà không cần workarounds ở runtime.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Command
build
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
any webpack-based build
Description
When using Angular v21 with the new esbuild builder, and using a file loader configured for certain file types (like SVG) the --deploy-url argument passed into the build command does not get prepended to the URL returned when importing a file of the said type, and there is no way to configure it to do so.
This was properly working previously with webpack, when loading of the SVG assets was configured with a rule like this:
{
test: /\.svg$/,
type: 'asset/resource',
generator: {
filename: '[name][hash][ext]',
},
}
Looks like with esbuild there is no way to achieve the same result, apart from manually adding deploy-url to imported URLs in runtime.
Minimal Reproduction
- Use
esbuildapplication builder - Configure angular.json to use
fileloader to import a certain file type:
"loader": {
".svg": "file"
},
- Build application using
ng build --deploy-url=/my-deploy-url/ - Import some SVG file in the app:
import mySvgUrl from './my-image.svg';
- Observe:
mySvgUrldoes not have/my-deploy-url/prepended to it
Exception or Error
No error
Your Environment
Angular CLI : 21.2.2
Angular : 21.2.4
Node.js : 24.8.0
Package Manager : npm 11.6.0
Operating System : darwin arm64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations │ 21.2.4 │ 21.2.4 │
│ @angular/build │ 21.2.2 │ 21.2.2 │
│ @angular/cdk │ 21.2.2 │ 21.2.2 │
│ @angular/cli │ 21.2.2 │ 21.2.2 │
│ @angular/common │ 21.2.4 │ 21.2.4 │
│ @angular/compiler │ 21.2.4 │ 21.2.4 │
│ @angular/compiler-cli │ 21.2.4 │ 21.2.4 │
│ @angular/core │ 21.2.4 │ 21.2.4 │
│ @angular/elements │ 21.2.4 │ 21.2.4 │
│ @angular/forms │ 21.2.4 │ 21.2.4 │
│ @angular/localize │ 21.2.4 │ 21.2.4 │
│ @angular/platform-browser │ 21.2.4 │ 21.2.4 │
│ @angular/platform-browser-dynamic │ 21.2.4 │ 21.2.4 │
│ @angular/router │ 21.2.4 │ 21.2.4 │
│ rxjs │ 7.8.2 │ 7.8.2 │
│ typescript │ 5.9.3 │ 5.9.3 │
│ vitest │ 4.0.18 │ 4.0.18 │
│ zone.js │ 0.16.0 │ 0.16.0 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 16 giờ 21 phút
- Pull request đã merge (30 ngày)
- 170
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Đang mởarea: @angular/build gemini-triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
angular/angular-cli#33055 · 1 bình luận · 3 reaction ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 người được giao ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 người được giao ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 1 người được giao ·
Tất cả issue của angular/angular-cli
Issue tương tự
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
Ecosystem: ClawMetry — the Qwen Code reader is now free and open source (follow-up to #9294 / #9338) Đang mởcategory/integration priority/P3 scope/documentation status/ready-for-human type/feature-request
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
-
area:auth FE mvp P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
klasolsson81/jobbliggaren#1788 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
get-convex/migrations#69 ·
-
accessibility angular bug good first issue typescript ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
apache/fineract-backoffice-ui#584 · 1 bình luận ·