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

fix: compatible with react 17 #46261

Merged
merged 1 commit into from Dec 5, 2023
Merged

fix: compatible with react 17 #46261

merged 1 commit into from Dec 5, 2023

Conversation

MadCcc
Copy link
Member

@MadCcc MadCcc commented Dec 5, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

close #46256

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English MISC: Fix useId error when webpack build with React 17
🇨🇳 Chinese MISC: 修复 React 17 以下使用 webpack 构建时报错 useId 找不到的问题。

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

stackblitz bot commented Dec 5, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Dec 5, 2023

Preview Is ready

Copy link
Contributor

github-actions bot commented Dec 5, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 328.53 KB (+52 B 🔺)
./dist/antd-with-locales.min.js 374.26 KB (-243 B 🔽)

Copy link

codesandbox-ci bot commented Dec 5, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3e8a129:

Sandbox Source
antd reproduction template (forked) Configuration

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e191962) 100.00% compared to head (3e8a129) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #46261   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          708       708           
  Lines        12108     12110    +2     
  Branches      3211      3211           
=========================================
+ Hits         12108     12110    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MadCcc MadCcc merged commit 937a1a2 into master Dec 5, 2023
113 checks passed
@MadCcc MadCcc deleted the fix/react-17 branch December 5, 2023 03:33
Copy link
Contributor

github-actions bot commented Dec 5, 2023

🎉 Thank you for your contribution! If you have not yet joined our DingTalk community group, please feel free to join us (when joining, please provide the link to this PR).

🎉 感谢您的贡献!如果您还没有加入钉钉社区群,请扫描下方二维码加入我们(加群时请提供此 PR 链接)。

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 5, 2023

啊, 这个menu 用例咋通过的

@guoshencheng
Copy link

when will it be released?

@fz6m
Copy link
Contributor

fz6m commented Dec 12, 2023

如果某个方法没有被导出,webpack 会发出没有 export 的警告,umi 之所以不提示是因为把 warning 都禁了。

可以尝试如下方法越过 webpack 检查:

import * as ReactExports from 'react'

const IDENT = 'useId'
const useId = IDENT in ReactExports ? ReactExports[IDENT] : fallback

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 this pull request may close these issues.

xport 'useId' (imported as 'useId') was not found in 'react' With react 17
6 participants