Skip to content
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

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

Open
husayt opened this issue Aug 21, 2024 · 6 comments
Open

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

husayt opened this issue Aug 21, 2024 · 6 comments

Comments

@husayt
Copy link
Contributor

husayt commented Aug 21, 2024

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.

@zhangHongEn
Copy link
Contributor

zhangHongEn commented Aug 22, 2024

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
Copy link
Contributor

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.

@gioboa gioboa changed the title Error when trying to load vite remote from webpack host. v1.0.0: Error when trying to load vite remote from webpack host. Aug 31, 2024
@ScriptedAlchemy
Copy link
Member

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

@Eliwang4264
Copy link

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

@ScriptedAlchemy
Copy link
Member

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

@zhangHongEn
Copy link
Contributor

zhangHongEn commented Oct 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants