fix: warning of check of rspack (#52168)

This commit is contained in:
二货爱吃白萝卜 2024-12-30 13:20:17 +08:00 committed by GitHub
parent 513f22784d
commit 993d514af3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,13 +15,10 @@ const defaultReactRender: RenderType = (node, container) => {
// Warning for React 19 // Warning for React 19
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
const majorVersion = parseInt(React.version.split('.')[0], 10); const majorVersion = parseInt(React.version.split('.')[0], 10);
const fullKeys = Object.keys(ReactDOM);
warning( warning(
majorVersion < 19 || majorVersion < 19 || fullKeys.includes('createRoot'),
!!(
ReactDOM as typeof ReactDOM & {
createRoot: VoidFunction;
}
).createRoot,
'compatible', 'compatible',
'antd v5 support React is 16 ~ 18. see https://u.ant.design/v5-for-19 for compatible.', 'antd v5 support React is 16 ~ 18. see https://u.ant.design/v5-for-19 for compatible.',
); );