-
Notifications
You must be signed in to change notification settings - Fork 295
Description
this is my host-app configuration
federation({
name: 'host-app',
filename: 'remoteEntry.js',
remotes: {
remote: 'http://localhost:3002/assets/remoteEntry.js'
},
shared: ['react', 'react-dom', '@lin/tools-component-library']
})
and this is my remote app configuration
plugins: [
...,
federation({
name: 'remote',
filename: 'remoteEntry.js',
exposes: {
'./Dashboard': './src/pages/dashboard/dashboard'
},
shared: ['react', 'react-dom', '@lib/tools-component-library']
})
],
base: 'http://localhost:3002',
server: {
open: true,
port: 3002,
cors: true
},
i can also see the file in browser at http://localhost:3002/assets/remoteEntry.js.
in my remote app terminal i can see the request but in browser it throws error
- Access to script at 'http://localhost:3002/assets/remoteEntry.js' from origin 'http://localhost:3001/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- GET http://localhost:3002/assets/remoteEntry.js net::ERR_FAILED 200 (OK)
- Uncaught TypeError: Failed to fetch dynamically imported module: http://localhost:3002/assets/remoteEntry.js
Versions
- vite-plugin-federation: v1.3.5
- vite: v5.1.0
Reproduction
Additional Details
Steps to reproduce
What is Expected?
it should show to remote exported content in the host app
What is actually happening?
Stuck on loading, showing console error
- Access to script at 'http://localhost:3002/assets/remoteEntry.js' from origin 'http://localhost:3001/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- GET http://localhost:3002/assets/remoteEntry.js net::ERR_FAILED 200 (OK)
- Uncaught TypeError: Failed to fetch dynamically imported module: http://localhost:3002/assets/remoteEntry.js