You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have the following scenerio that I have trouble with, any help will be appreciated!
I have a react project that I exposed one of its component as a module federation:
The issue that it creates me a dist folder with index.mjs file that calls the federation.js files with an incorrect path (without assets folder). And second after I fix it manually it fails for runtime issues.
Is it possible to do what am I trying and if so what am I missing?
Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have the following scenerio that I have trouble with, any help will be appreciated!
I have a react project that I exposed one of its component as a module federation:
export default defineConfig({
plugins: [
react(),
federation({
name: "home",
filename: "homepage.js",
exposes: {
'./Wheel': './src/components/wheel/WheelGame.tsx',
},
shared: ['react','react-dom']
})
],
build: {
modulePreload: false,
target: 'esnext',
minify: false,
cssCodeSplit: false
}
})
The react project the uses it as a remote needs to be at the end npm package. The vite config is as follow:
export default defineConfig({
build: {
lib: {
entry: 'src/index.ts',
name: 'BridgeComponent',
fileName: 'index',
},
outDir: "dist",
target:"esnext",
rollupOptions: {
external: ["react", "react-dom"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
plugins: [
react(),
federation({
name: 'app',
remotes: {
homepage: 'http://localhost:5001/assets/homepage.js'
},
shared: ['react','react-dom']
}),
tsconfigPaths()
],
});
The issue that it creates me a dist folder with index.mjs file that calls the federation.js files with an incorrect path (without assets folder). And second after I fix it manually it fails for runtime issues.
Is it possible to do what am I trying and if so what am I missing?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions