Exported PropTypes shapes get lost in translation
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
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react
- Lĩnh vực
- build-system
Hướng nghiên cứu
Tái hiện lệnh microbundle đã được báo cáo với import LocaleShape dùng chung và kiểm tra bundle được tạo, trong đó shape PropTypes được export trở thành null. So sánh với build đang hoạt động, trong đó shape được nhân đôi; hoàn tất khi các shape được import vẫn hợp lệ và cảnh báo prop-type của React không còn báo expected one of [null,null].
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi there,
Thank you for the great work you've done with microbundle. For the record, here is how I'm using the lib:
microbundle --jsx React.createElement --no-compress --format modern,cjs
I'm using react in version 17 and microbundle in version 0.12.0-next.9
I've got a PropType shape that is used in several definitions:
import PropTypes from "prop-types";
const LocaleShape = PropTypes.shape({
// two-char language code ("en", "fr", "de")
tag: PropTypes.string.isRequired,
// human readable language description
language: PropTypes.oneOf([PropTypes.object, PropTypes.string]).isRequired,
//latin, cyrillic, etc.
script: PropTypes.string,
// two-char region code ("US", "CA", "GB", "CH")
region: PropTypes.string,
// text direction / orientation: right to left, left to right
orientation: PropTypes.oneOf(["rtl", "ltr"]),
// optional emoji string for displaying a flag 🇨🇬 🇲🇼 🇹🇩
flag: PropTypes.string,
// String that can be used to search for a locale
keywords: PropTypes.string,
// locale identifier of the fallback locale
fallback: PropTypes.string,
// optional identifier. If not specified, locale identifier will result in the concatenation
// of tag and region, with a dash separator: "en-GB", "fr-CA", "nl-BE"
id: PropTypes.string,
});
export default LocaleShape;
This shape is imported in different files:
LocaleChooser.propTypes = {
value: PropTypes.oneOfType([LocaleShape, PropTypes.arrayOf(LocaleShape)]),
locales: PropTypes.arrayOf(LocaleShape),
}
When the bundle is built, it looks like the exported PropType shape is turned into null, as explain the warnings I receive in console:
Warning: Failed prop type: Invalid prop `locales[0].language` of value `[object Object]` supplied to `LocaleChooser`, expected one of [null,null].
This warning is suppressed once I remove the imports and duplicate the LocaleShape in every file that requires it. Am I missing a parameter in the command?
Thanks for your help
- 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 ·