-
Notifications
You must be signed in to change notification settings - Fork 29
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
Error sharing "react-dom" in dev mode #88
Comments
Can you provide a reproducible example? |
It should be the same issue as this one, I will fix it today #89
…---- Replied Message ----
| From | Russell ***@***.***> |
| Date | 09/17/2024 05:37 |
| To | module-federation/vite ***@***.***> |
| Cc | Subscribed ***@***.***> |
| Subject | [module-federation/vite] Error sharing "react-dom" in dev mode (Issue #88) |
Everything has been working pretty well so far 🙂 I did run into one issue when sharing "react-dom" in dev mode:
chunk-5GRLQEB4.js?v=8f475596:27Uncaught(inpromise) TypeError: factoryisnotafunctionatchunk-5GRLQEB4.js?v=8f475596:27:29atasyncchunk-5GRLQEB4.js?v=8f475596:34:97
This line in the bundle:
const mfproxyawaitrequire_vite_mf_2_host_loadShare_react_mf_2_dom_loadShare = await require_vite_mf_2_host_loadShare_react_mf_2_dom_loadShare();
It seems like when it calls into the runtime, the host's options -> shared, is missing react-dom, although the Vite plugin specifies it.
Maybe in here?
https://github.com/module-federation/vite/blob/b1bba84c563f5eea7e92aad250f422d0b624f664/src/plugins/pluginProxySharedModule_preBuild.ts#L40
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Hello, I have the same error with my project using vite for the host and webpack for remotes but only on preview mode after a build. It works correctly in dev mode. |
Can you create a basic reproduction repo please? |
@tduforet are you using the latest release ? |
Yes, it wasn't the latest when I had the problem the first time. I updated the version to the latest and I always have the problem. |
I added the config below in the react example and it's working fine.
You can try to figure out step by step the piece of code that is creating that error. Without a failing example it's impossible to face the issue. I'm sorry |
Yes I understand, I try to add some log, the factory is false si maybe there is a problem on loadShare method for react. Thanks for your help. |
Here’s an important issue. It only occurs in build mode, and it would be great if you could provide a reproducible example. |
Hello, I removed one by one the different plugins I had in my project and it seems the plugin vite-plugin-svgr (4.2.0) is the problem. |
For now I don't understand why but it works only if I use the svgr plugin after the federation plugin in the vite config. |
plugins: [
federation(),
svgr()
] Will adjusting the order solve the problem? That would be great! |
Yes it works when svgr is after federation but I don't know why 😅 |
The two plugins with |
Yep, we need to consider it because we can have this kind of errors with many other plugins. |
was thinking wrap federation under your own plugin and add a |
Everything has been working pretty well so far 🙂 I did run into one issue when sharing "react-dom" in dev mode:
This line in the bundle:
It seems like when it calls into the runtime, the host's options -> shared, is missing react-dom, although the Vite plugin specifies it.
Maybe in here?
vite/src/plugins/pluginProxySharedModule_preBuild.ts
Line 40 in b1bba84
The text was updated successfully, but these errors were encountered: