Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed components has weird module #659

Open
necatisarhanli opened this issue Jan 2, 2025 Discussed in #652 · 1 comment
Open

Exposed components has weird module #659

necatisarhanli opened this issue Jan 2, 2025 Discussed in #652 · 1 comment

Comments

@necatisarhanli
Copy link

Discussed in #652

Originally posted by necatisarhanli December 31, 2024
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
Screenshot 2024-12-31 at 01 45 16

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.

@necatisarhanli
Copy link
Author

I also had some questions for use cases , is there any discord or slack channel for discuss stuff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant