Exposed components has weird module #652
Unanswered
necatisarhanli
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Remote Vite config
export default defineConfig({
plugins: [
react(),
federation({
name: 'collection',
filename: 'remoteEntry.js',
shareScope: 'default',
exposes: {
'./Test': './src/Test',
},
shared: [
"react",
"react-dom",
"react-router-dom",
"@privatescope/xcomponent",
],
})
],
build: {
sourcemap: false,
target: 'esnext',
minify: false,
cssCodeSplit: false,
rollupOptions: {
output: {
interop: "auto"
},
},
terserOptions: {
compress: false,
mangle: false,
},
},
})
Host Vite Config
export default defineConfig({
plugins: [
react(),
legacy({
targets: ['defaults', 'not IE 11'],
additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
}),
federation({
name: "host",
remotes: {
collection: "http://localhost:5002/assets/remoteEntry.js"
},
shared: [
"react",
"react-dom",
"react-router-dom",
"@privatescope/xcomponent",
],
}),
],
define: {
global: 'window',
},
build: {
sourcemap: false,
target: 'es2015',
minify: false,
cssCodeSplit: false,
},
server: {
port: 6161,
},
resolve: {
alias: {
[...]
},
},
})
// exposed component
import Xcomponent from '@privatescope/xcomponent'
const Test = () => {
return ()
}
export default Test ;
// host , component usage
import Test from 'collection/Test';
...
...
when run console.log(Test) the result is this

Once I tried to run Remote project by its own alone it works fine the componnt is there instead of this module chain, but when I tried the use same component () inside the host error is there .
vitejs/vite#16201
also i find this issue its kinda similar but solutions that they put is not working for me.
Beta Was this translation helpful? Give feedback.
All reactions