-
-
Notifications
You must be signed in to change notification settings - Fork 367
refactor(bridge-react): Refactor the bridge-react to better support multiple React versions from React 16 to React 19 #3690
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
Conversation
…ith enhanced createRoot options
…m/module-federation/core into feat/react-bridge-compat-reactv19
…reateBridgeComponent
🦋 Changeset detectedLatest commit: 1ecdeba The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
You can choose specific import paths based on the React version used in your project: | ||
|
||
```jsx | ||
// Auto-detect React version (recommended for most scenarios) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to detect, I'm not found the logic.(maybe just not in this diff)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* - import { createBridgeComponent } from '@module-federation/bridge-react/v18' | ||
* - import { createBridgeComponent } from '@module-federation/bridge-react/v19' | ||
*/ | ||
function defaultCreateRoot( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no react 19 here 🤔
:::danger | ||
请注意:使用 `@module-federation/bridge-react` 后不能将 `react-router-dom` 设置成 shared,否则构建工具将会提示异常。这是因为 `@module-federation/bridge-react` 通过代理 `react-router-dom` 实现了对路由的控制,以保证应用间路由能够正常协同工作。 | ||
:::danger 注意 | ||
使用 `@module-federation/bridge-react` 后不能将 `react-router-dom` 设置成 shared,否则构建工具将会提示异常。这是因为 `@module-federation/bridge-react` 通过代理 `react-router-dom` 实现了对路由的控制,以保证应用间路由能够正常协同工作。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we auto detect it on build plugin ?
} | ||
|
||
// For React 16/17, use legacy API | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throw error if the react is 19
Description
refactor(bridge-react): Refactor the bridge-react to better support multiple React versions from React 16 to React 19, in the meantime maintaining backward compatibility and providing clearer version-specific entry points.
Related Issue
Types of changes
Checklist