vite icon indicating copy to clipboard operation
vite copied to clipboard

v1.0.0: Error when trying to load vite remote from webpack host.

Open husayt opened this issue 1 year ago • 6 comments

Have tried loading our vite remote with host using module federation runtime but built with webpack. Get this error when calling loadRemote():

logger.ts:14 Error loading remoteEntry.js Error: @vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201

Remote should be able to be loaded by webpack host, especially if using MF2 runtime.

husayt avatar Aug 21 '24 12:08 husayt

Need to turn off the hmr of the react plugin

Webpack host cooperates with rust remote. I guess HMR will also have problems, which requires customized special processing

zhangHongEn avatar Aug 22 '24 02:08 zhangHongEn

When both the host and the remote are in dev mode, you need to ensure that react-refresh is a singleton and initialized earlier than react-dom. This may require modifying @vitejs/plugin-react I am currently giving priority to completing mf’s capabilities, and will look at react issues later.

zhangHongEn avatar Aug 29 '24 02:08 zhangHongEn

Hmr typically requires us hooking into reacts devtools global to access hmr, if that helps we have a refresh runtime plugin in one of our libraries. Hmr only works when remotes use the json protocol not the js entry

ScriptedAlchemy avatar Oct 04 '24 00:10 ScriptedAlchemy

I encountered the same problem when host ->webpack+react, remote vite+react Runtiem loading, So will we solve this problem from the perspective of the lib, or can we only close Vite's HMR

Eliwang4264 avatar Oct 14 '24 02:10 Eliwang4264

I'm not sure if it will be possible to apply cross bundler HMR. Let me think about it.

ScriptedAlchemy avatar Oct 16 '24 16:10 ScriptedAlchemy

Vue React React-Refresh maintains singleton and is a dev version

---- Replied Message ---- | From | Zack @.> | | Date | 10/17/2024 00:25 | | To | module-federation/vite @.> | | Cc | zhn @.>, Comment @.> | | Subject | Re: [module-federation/vite] v1.0.0: Error when trying to load vite remote from webpack host. (Issue #65) |

I'm not sure if it will be possible to apply cross bundler HMR. Let me think about it.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

zhangHongEn avatar Oct 17 '24 01:10 zhangHongEn

As there's been no activity for 30 days, this issue has been flagged as stale. If you'd like it to remain open, please add a comment within the next 7 days. Thank you.

github-actions[bot] avatar Nov 11 '25 14:11 github-actions[bot]