vite-plugin-federation icon indicating copy to clipboard operation
vite-plugin-federation copied to clipboard

All shared dependencies are being fetched multiple times, not working as single instance ..

Open AsuraKev opened this issue 1 year ago • 5 comments

Hi All,

I am getting React error as below when I have already listed react, react-dom, react-router as shared in both host and remote Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

image

AsuraKev avatar Jun 29 '23 21:06 AsuraKev

Having the same issue! Do you have the same use case as this one: #449 ? Do you have modules being both host and remote?

christophediprima avatar Jul 04 '23 12:07 christophediprima

For more information I have the following setup

Remote vite config

image

Remote exposed register function image

In host I just called the register function to mount the remote app. This is different from the example where instead of just importing the remote component, instead I invoke a method to load the remote application

image

AsuraKev avatar Jul 15 '23 03:07 AsuraKev

Downgraded to version 1.1.14 and its working. Latest version seems to be broken

AsuraKev avatar Aug 30 '23 02:08 AsuraKev

Downgraded to version 1.1.14 and its working. Latest version seems to be broken

we have a different problem back in 1.1.14, it's the shared does not have checksum at the end which cause the caching error - a big reason why I had to upgrade to 1.3.*

coolcorexix avatar Feb 02 '24 06:02 coolcorexix

I am switching to rspack soon. A lot of native module federation support going to happen there! This package looks like it’s being abandoned

AsuraKev avatar Feb 02 '24 07:02 AsuraKev