module-federation-examples icon indicating copy to clipboard operation
module-federation-examples copied to clipboard

Not able to run React with vite from the example

Open AshwinPetari opened this issue 1 year ago • 8 comments

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

AshwinPetari avatar Nov 11 '23 20:11 AshwinPetari

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

ScriptedAlchemy avatar Nov 13 '23 23:11 ScriptedAlchemy

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

AshwinPetari avatar Nov 14 '23 13:11 AshwinPetari

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.

ScriptedAlchemy avatar Nov 27 '23 07:11 ScriptedAlchemy

Let me try it out

AshwinPetari avatar Nov 27 '23 19:11 AshwinPetari

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.

ScriptedAlchemy avatar Nov 30 '23 23:11 ScriptedAlchemy

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.

danielm2402 avatar Apr 10 '24 00:04 danielm2402

Any progress on this issue ?

nahimr avatar Apr 16 '24 13:04 nahimr

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?

bharatwaj avatar May 20 '24 13:05 bharatwaj