Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.1.1 版本构建出的 UMD 模块报错,找不到 React #574

Closed
ShenHongFei opened this issue May 24, 2023 · 8 comments · Fixed by #575
Closed

5.1.1 版本构建出的 UMD 模块报错,找不到 React #574

ShenHongFei opened this issue May 24, 2023 · 8 comments · Fixed by #575

Comments

@ShenHongFei
Copy link

5.1.0 正常
升级到 5.1.1 之后出现

Uncaught TypeError: Cannot read properties of undefined (reading 'createContext')
at icons.min.js:1:695124
at icons.min.js:1:795911
at icons.min.js:1:795916
at icons.min.js:1:247
at icons.min.js:1:329

image

可能的原因是
window 上取不到 window.React 属性,应该直接取 React 属性
image

@zombieJ
Copy link
Member

zombieJ commented May 24, 2023

搞个重现看看?我 Debug 一下~

@PeachScript
Copy link
Member

https://github.com/ant-design/ant-design-icons/pull/573/files#diff-c57dba5b5e9d091e853c615d28ab7e34c12efc1302a862cf6ecbd22d8fb75a10R10 @PeachScript 看一下是不是配置不兼容

应该是的,externals 配置需要省略 window,旧版基于 Rollup,新版基于 Webpack

@zombieJ zombieJ closed this as completed May 24, 2023
@afc163 afc163 reopened this May 24, 2023
@afc163
Copy link
Member

afc163 commented May 24, 2023

Fixed in 49a8c61

@afc163
Copy link
Member

afc163 commented May 24, 2023

@zombieJ 请发 PR

@ShenHongFei
Copy link
Author

5.1.2 版本修复了找不到 React 的报错,但还是没有 icons 全局变量,似乎所有的导出都放到了 window 上

image

webpack 中 externals 配置如下

image

@PeachScript @afc163

@afc163
Copy link
Member

afc163 commented Feb 26, 2024

这个问题疑似还在。

@PeachScript
Copy link
Member

这个问题疑似还在。

问题有复现吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants