Officially support more elaborate externals
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
- 25/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ệ
- javascript, rollup
- Lĩnh vực
- build-system, cli
Hướng nghiên cứu
Bắt đầu với việc xử lý external và exclude trong src/index.js#L387-L388, sau đó xem xét hành vi dòng lệnh được đề xuất trong issue cho --external và --external-glob. Công việc được xem là hoàn tất khi ngữ nghĩa cấu hình được chọn đã được triển khai và ghi lại trong tài liệu, bao gồm cả cách các dependency và import không theo chuẩn được xử lý.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This is a feature request/Proposal
As a user of microbundle I want ways to configure which imports are to be considered external.
In order to reduce my bundle size and also to work with non-standard imports (images, fonts, ...) that are not supported by microbundle.
Status Quo
- As described in https://github.com/developit/microbundle/issues/283#issuecomment-523879163, there is a (I guess unoffical) way to use regex in the
--excludeflag, which can be used to have rollup treat specific import statements as external. - Presence of the
--excludeflag triggers if pkg.dependencies are treated as external or not (see index.js#L387) I find that quite confusing and the behaviour is not documented.
Problem
Given I want to use --external .*/assets/.* to work with non-standard imports
And I also want all my dependencies to be excluded
Then I need to add all dependencies to --external causing code duplication and manual overhead.
Proposal
In order to fix the problem and reduce confusion I propose to have it work like this:
$ microbundle
Exclude dependencies, peerDependencies
$ microbundle --external .*/assets/.*
Exclude dependencies, peerDependencies and .*/assets/.*
And explicitly support regular expressions or globs under --external
$ microbundle --external .*/assets/.*,angular --include-dependencies
Exclude peerDependencies and .*/assets/.*
All normal dependencies ecxept angular are included in the bundle
Non-breaking alternative
I realize that the above proposal is really tied to my personal usecase of (miss-?)using --external for non-standard imports.
It would also introduce a potential pretty impactful breaking change (since users of microbundle might ship bundles that lack bundled dependencies).
Alternatively the current behaviour could stay as is, using regex in --external will be considered hacky. And we introduce a new, documented way to exclude assets:
$ microbundle --external-glob **/*.(jpg|png)
Exclude dependencies, peerDependencies and all imports matching **/*.(jpg|png)
$ microbundle --external angular --external-glob **/*.(jpg|png)
Exclude peerDependencies, angular, and all imports matching **/*.(jpg|png)
Let me know what you think about this. I would be really happy to implement the changes and provide a PR.
- Ngôn ngữ chính
- JavaScript
- Star
- 8.1k
- Fork
- 358
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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 developit/microbundle
-
CSS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
developit/microbundle#1002 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
developit/microbundle#789 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
developit/microbundle#1100 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
developit/microbundle#1094 · 1 bình luận ·
-
Disable minification by default Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
developit/microbundle#1093 · 3 bình luận · 1 reaction ·
Tất cả issue của developit/microbundle
Issue tương tự
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Improve Title Support Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·