patternfly / patternfly/patternfly-react
Bug - react-icons 6.6.1- invalid ESM module
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ả
Describe the problem
Webpack build fails with error:
ERROR in ./node_modules/@patternfly/react-icons/dist/esm/createIcon.js 2:0-63
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/home/xxx/repos/pf_modules/node_modules/@patternfly/react-icons/dist/esm'
Did you mean 'jsx-runtime.js'?
BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
How do you reproduce the problem?
minimal code to recreate the issue: https://github.com/rszwajko/pf-icons-esm-bug
Initially encountered while updating libraries on older branches of https://github.com/openshift/networking-console-plugin
Expected behavior
Webpack build should work without relaxing import rules.
Is this issue blocking you?
No. Workaround exists i.e. as used here https://github.com/openshift/networking-console-plugin/commit/e4ed48dabced60f949d4af09559996b131c93fba
{
test: /\.m?js/,
include: /node_modules\/@patternfly\/.*/,
resolve: {
fullySpecified: false,
},
},
What is your environment?
React 17
react-icons 6.6.1
What is your product and what release date are you targeting?
https://github.com/openshift/networking-console-plugin
Jira Issue: PF-4648
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
Bắt đầu với bản tái hiện tối thiểu tại https://github.com/rszwajko/pf-icons-esm-bug và kiểm tra import react/jsx-runtime được tạo trong @patternfly/react-icons/dist/esm/createIcon.js dưới Webpack. Tái hiện lỗi với React 17 và react-icons 6.6.1; hoàn tất khi bản build Webpack hoạt động mà không nới lỏng các quy tắc import.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react, typescript, webpack
- Lĩnh vực
- build-system, frontend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 64/100