-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: runtime plugin to mount multi react version app (#3818)
* feat: runtime plugin to mound multi react version app * feat: runtime plugin to mound multi react version app * update factory * update factory * sync with m * sync main * fix tests * improve doc * improve doc * improve doc * locks * add tests --------- Co-authored-by: ScriptedAlchemy <zackaryjackson@bytedance.com>
- Loading branch information
1 parent
68fa25c
commit e9aed1e
Showing
42 changed files
with
42,300 additions
and
45,989 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,4 @@ | ||
# Mixed React Versions and Compatibility levels | ||
# Example has moved | ||
|
||
This example demos the ability to load two separate versions of react. | ||
For an example implementation of using different React versions together with Module Federation, check out the runtime plugin folder [runtime-plugins/multiple-react-versions](https://github.com/module-federation/module-federation-examples/tree/master/runtime-plugins/multiple-react-versions). | ||
|
||
Module Federation allows us to create an adapter which attaches a hooks-friendly version to render a section of thr app using modern versions. | ||
|
||
- `app1` uses and older version of react, not compatible with react Hooks | ||
- `app2` uses a modern react version and its components are hooks based | ||
|
||
The adapter consumes both versions of react to "translate" the props into a fresh render. This could be presented as a HOC or federated components could have a legacy export containing the adapter build in. | ||
|
||
# Running Demo | ||
|
||
Run `pnpm run start`. This will build and serve both `app1` and `app2` on ports 3001 and 3002 respectively. | ||
|
||
- [localhost:3001](http://localhost:3001/) (HOST) | ||
- [localhost:3002](http://localhost:3002/) (STANDALONE REMOTE) | ||
|
||
<img src="https://ssl.google-analytics.com/collect?v=1&t=event&ec=email&ea=open&t=event&tid=UA-120967034-1&z=1589682154&cid=ae045149-9d17-0367-bbb0-11c41d92b411&dt=ModuleFederationExamples&dp=/email/DifferentReactVersions"> |
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
different-react-versions-16-17/app1/src/components/ReactAdapterConsumer.js
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
different-react-versions-16-17/app2/src/components/ReactAdapterProvider.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.