Bug - react-icons 6.6.1- invalid ESM module
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 64/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript, webpack
- 领域
- build-system, frontend
调研方向
从 https://github.com/rszwajko/pf-icons-esm-bug 中的最小复现开始,并检查 Webpack 下 @patternfly/react-icons/dist/esm/createIcon.js 生成的 react/jsx-runtime import。使用 React 17 和 react-icons 6.6.1 重现该失败;当 Webpack 构建无需放宽 import 规则即可正常工作时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- TypeScript
- 星标
- 862
- 派生
- 392
- 平均合并
- 4 天 8 小时
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
patternfly/patternfly-react 的其他 Issue
-
PF Team
难度 2/5 1-3 小时 新手友好度 68/100
patternfly/patternfly-react#12651 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
patternfly/patternfly-react#12637 ·
-
PF Team
难度 2/5 1-3 小时 新手友好度 72/100
patternfly/patternfly-react#12617 · 1 条评论 ·
-
PF Team
难度 2/5 1-3 小时 新手友好度 68/100
patternfly/patternfly-react#12610 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 68/100
patternfly/patternfly-react#12600 ·
查看 patternfly/patternfly-react 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 90/100
TanStack/tanstack.com#1293 ·