Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Proposal: Asset Budgets potentially w/ subtypes

Đang mở
#13,393 18 bình luận 61 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

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

Hướng nghiên cứu

Yêu cầu này nhắm đến các budget của ng build trong cấu hình production và đề xuất các subtype asset:jpg, asset:svg và asset:png; không xác định tệp nguồn hoặc test nào. Trước tiên, hãy truy vết cách xử lý budget hiện có được ng build sử dụng, sau đó xác minh rằng các asset vượt quá kích thước cho phép sẽ kích hoạt các ngưỡng cảnh báo và lỗi đã cấu hình cho từng subtype.

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

Mô tả

area: @angular-devkit/build-angular devkit/build-angular:browser feature feature: insufficient votes
Bug Report or Feature Request (mark with an x)
- [ ] bug report -> please search issues before submitting
- [x] feature request
Command (mark with an x)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions

Mac High Sierra

MacBook-Pro:~ damien$ node --version
v8.9.4
MacBook-Pro:~ damien$ npm --version
5.6.0
MacBook-Pro:daffodil damien$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 7.1.0
Node: 8.9.4
OS: darwin x64
Angular: 7.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.10.7
@angular-devkit/build-angular      0.10.7
@angular-devkit/build-ng-packagr   0.10.7
@angular-devkit/build-optimizer    0.10.7
@angular-devkit/build-webpack      0.10.7
@angular-devkit/core               7.1.0
@angular-devkit/schematics         7.1.0
@angular/cdk                       7.1.0
@angular/cli                       7.1.0
@angular/pwa                       0.11.3
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.0.7
@schematics/angular                7.1.0
@schematics/update                 0.11.0
ng-packagr                         4.4.0
rxjs                               6.3.3
typescript                         3.1.6
webpack                            4.19.1
Repro steps
  1. Have bundle with 2mb budget
  2. Desire a budget that says all image assets are under 1mb.
  3. Create an asset that is 1.5mb
  4. Be unable to know that the asset outside of budget range as the "any" budget type will catch the bundle.
The log given by the failure

N/A

Desired functionality

I would like to set a budget specifically for image assets in my ng build. Ideally, I can configure this per image type (as each image type has different compressability.

e.g

{
  ...
  "configurations": {
    "production": {
      ...
      budgets: [
         {"type": "asset:jpg", "maximumWarning": "150kb", "maximumError": "300kb"},
         {"type": "asset:svg", "maximumWarning": "15kb", "maximumError": "30kb"},
         {"type": "asset:png", "maximumWarning": "150kb", "maximumError": "300kb"},
       ]
    }
  }
}

The use case here is automation around enforcing filesize requirements for assets to prevent absurd image sizes from being included. While "type": "any" meets this requirement, there are niches of asset types that should have stricter requirements (e.g. svg).

Mention any other details that might be useful

I'm trying to create budgets for the assets we use on the Daffodil project:
https://github.com/graycoreio/daffodil

Specifically, the PR in question:
https://github.com/graycoreio/daffodil/pull/171

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.