patternfly / patternfly/patternfly-react
Bug - Package Publishing - Published Libraries should follow NPM dual module package standards
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 862
- Fork
- 392
- Merge trung bình
- 4 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 9
Mô tả
PatternFly libraries should follow NPM standards for publishing dual module (CommonJS/ESModule) packages.
PatternFly packages have
"main": "dist/js/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
This is a really early format when es modules were being initially developed and not supported by modern tooling.
NPM documentation links to this as the right way to handle dual module packages.
{
"type": "module",
"exports": {
"import": "./index.mjs",
"require": "./index.cjs"
}
}
Modern tooling like vite builds libraries with a combination of both for compatibility.
{
"name": "my-lib",
"type": "module",
"main": "./dist/my-lib.umd.cjs",
"types": "./dist/my-lib.d.ts",
"module": "./dist/my-lib.js",
"exports": {
".": {
"import": "./dist/my-lib.js",
"require": "./dist/my-lib.umd.cjs"
}
}
}
This is currently blocking us from using vitest to test because it gets really confused. It tries to import the code as ESM but then is unhappy that the package is not marked as type "module". If we manually add type 'module', it then runs into some code that uses a 'require', which is not valid in the scope of a module.
PatternFly packages should support both ESM and CommonJS using NPM standards for better compatibility.
This affects all PF packages not just react-core.
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.
Hướng nghiên cứu
Rà soát các trường siêu dữ liệu gói được hiển thị trong issue trên tất cả các gói PatternFly, sau đó tái hiện vấn đề phân giải module hiện tại bằng vitest. Trước tiên, hãy kiểm tra các tài liệu tham chiếu NPM package-examples và Vite library-mode; công việc được xem là hoàn tất khi mọi gói bị ảnh hưởng đều hỗ trợ cả ESM và CommonJS thông qua siêu dữ liệu gói tiêu chuẩn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- nodejs, typescript
- Lĩnh vực
- build-system, developer-experience, release
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100