// Lazy-loaded
const ProfilePage =
React.lazy(() => import('./ProfilePage'));
// Show a spinner while the profile is loading
<Suspense fallback={<Spinner />}>
<ProfilePage />
</Suspense>
new ModuleFederationPlugin({
name: "appb",
filename: "remoteb.js",
exposes: {
"./HelloFromB": "./src/HelloFromB",
},
shared: ["react", "react-dom"],
}),
new ModuleFederationPlugin({
name: "appb",
filename: "remoteb.js",
exposes: {
"./HelloFromB": "./src/HelloFromB",
},
shared: {
"react": { singleton: true },
"react-dom": { singleton: true }
},
}),
const deps = require("./package.json").dependencies;
...
new ModuleFederationPlugin({
name: "appb",
filename: "remoteb.js",
exposes: {
"./HelloFromB": "./src/HelloFromB",
},
shared: {
...deps,
"react": { singleton: true,
requiredVersion: deps["react"] },
"react-dom": { singleton: true,
requiredVersion: deps["react-dom"] }
},
}),