module-federation / module-federation-examples

Implementation examples of module federation , by the creators of module federation
https://module-federation.io/
MIT License
5.48k stars 1.73k forks source link

Not able to run React with vite from the example #3326

Open AshwinPetari opened 9 months ago

AshwinPetari commented 9 months ago

Im trying to see if Vite can work with React as I saw there are some issues for module federation for React. I'm not sure what is wrong, but when I clone this repo and run this locally with the commands mentioned, it throws the following error and doesn't load anything.

image

Even with this other repo, it throws the following error. It leads me to believe one of the dependencies might have broken

image
ScriptedAlchemy commented 9 months ago

try enabling CORS, looks like a cors issue potentially, also check its using right react version which has createRoot

AshwinPetari commented 9 months ago

Vite by default have all origins enabled and using browser based extensions throw the same error. Requesting to reopen this ticket and actually run this locally to reproduce the error.

image
ScriptedAlchemy commented 8 months ago

Ive fixed the example partially, but there are still some issues on the webpack side, i think it needs html webpack plugin if you want to send a pr adding it.

AshwinPetari commented 8 months ago

Let me try it out

ScriptedAlchemy commented 8 months ago

Send pr if you make any progress, its likely missing html webpack plugin setup - it loos like some new version removes some presets that used to exist there.

danielm2402 commented 4 months ago

I cloned this example and am getting the same issue. How could I solve it? Could you post a PR if you show me the problem.

nahimr commented 4 months ago

Any progress on this issue ?

bharatwaj commented 2 months ago

I am running into the same issue with example vite-react-microfrontends. react-dom and react are getting downloaded as expected but it is not getting set as expected.

createRoot-error

@ScriptedAlchemy Any thoughts? Could you please clarify on your comment wrt html webpack plugin. This example does not use webpack plugin right?