Closed dawidmarczakcompany closed 4 months ago
Might wan to try
export default defineConfig({
plugins: [
react(),
federation({
name: "my-apps",
remotes: {
dummy: "", //Need to provide some dummy declaration; https://github.com/originjs/vite-plugin-federation/discussions/159#discussioncomment-7633645
},
shared: {
react: { singleton: true, requiredVersion: '^18.2.0' },
'react-dom': { singleton: true, requiredVersion: '^18.2.0' },
},
}),
],
build: {
target: "esnext",
},
});
I found the solution - in the "shared" object I had to add also "react-redux" as I had this library used in host and microfront.
Errors from module federation are unclear in this case, and they didn't say anything about Redux.
Versions
Reproduction
Vite config of the host app
Vite config of the remote app
What is Expected?
Remote loads correctly
What is actually happening?
I got error - TypeError: Cannot read properties of null (reading 'useContext')
Anyone have solution for this?