Fix ESM exports
Maintainer thường phản hồi trong vòng 1 ngày
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
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
- Lĩnh vực
- build-system, developer-experience
Hướng nghiên cứu
Bắt đầu bằng việc xem xét metadata của package và các ví dụ ESM được nêu trong issue, bao gồm rc-field-form/es/utils/validateUtil.js, rc-dialog/es/Dialog/Content/Panel.d.ts và rc-picker/es/interface.d.ts. Kiểm tra cách các package rc-* cung cấp các cây thư mục lib và es của chúng trong tsconfig NodeNext được hiển thị. Hoàn tất có nghĩa là các ESM imports và type imports trong các module react-component được resolve mà không có các lỗi TypeScript, runtime hoặc esbuild được liệt kê.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
There are many errors to fix in all react-component modules for them to work well when imported from an ESM module.
Importing things from "rc-???" & types from "rc-???/es/..." from an ESM module with recommended (less fault-tolerant / strictest) TS config should not raise any error.
My tsconfig.json contains:
{
"compilerOptions": {
"moduleResolution": "NodeNext",
"module": "NodeNext",
"skipLibCheck": false,
"skipDefaultLibCheck": false,
"allowImportingTsExtensions": false,
"allowSyntheticDefaultImports": false,
"strict": true,
"verbatimModuleSyntax": true,
"isolatedModules": true
},
}
Origin of errors:
- ESM files in
"rc-???/es/..."must have.d.mtsor.mjsextension, or apackage.jsoncontaining{"type":"module"}must be added to the folder - in
"rc-???/es/..."do not import any file from CJS exports of a module, there should not have anyimport ... from 'rc-???/lib/...';=> import will fail if (and it would be a good thing) imported module restricts its/lib/path to only CJS requires (exportsfield inpackage.json) - in
"rc-???/es/..."any relative import (specifier or expression) in a.d.tsor.jsshould point to a file (not a directory) and have a file extension => TS error since modules are resolved asany - there should be no comment between
/*#__PURE__*/comment and the function call, cfrc-field-form/es/utils/validateUtil.js=> esbuild error during build - modules with no default export (such as
react) should not be imported usingimport Module from 'module'but instead withimport * as Module from 'module', cfrc-dialog/es/Dialog/Content/Panel.d.tsorrc-picker/es/interface.d.ts=> TS error withallowSyntheticDefaultImportsdisabled and runtime error without a bundler that fakes a default import - TS looks for types through the
mainfield ofpackage.json, even when module is imported from an ESM, sopackage.jsonshould be patched with:
- "main": "./lib/index",
- "module": "./es/index",
+ "exports": {
+ ".": {
+ "types": {
+ "import": "./es/index.d.ts",
+ "default": "./lib/index.d.ts"
+ },
+ "import": "./es/index.js",
+ "default": "./lib/index.js"
+ },
+ "./es/*": {
+ "types": {
+ "import": "./es/*"
+ },
+ "import": "./es/*"
+ },
+ "./lib/*": {
+ "types": {
+ "require": "./lib/*"
+ },
+ "require": "./lib/*"
+ }
+ },
Interesting reading:
- Ngôn ngữ chính
- TypeScript
- Star
- 670
- Fork
- 205
- Merge trung bình
- 15 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 react-component/util
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
react-component/util#816 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
injectCSS method not attaching csp nonce passed to it. it is used in antd components internallyĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
react-component/util#671 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
react-component/util#738 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
react-component/util#710 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
react-component/util#647 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của react-component/util
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
diegosouzapw/OmniRoute#14869 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
Maintainer thường phản hồi trong vòng 1 ngày
-
status: waiting triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
freeCodeCamp/freeCodeCamp#70412 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability untriaged
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
opensearch-project/OpenSearch-Dashboards#12816 ·
Maintainer thường phản hồi trong vòng 1 ngày