52 lines
1.9 KiB
TypeScript
Executable File
52 lines
1.9 KiB
TypeScript
Executable File
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import federation from '@originjs/vite-plugin-federation'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react({
|
|
jsxRuntime: 'automatic'
|
|
}),
|
|
tailwindcss(),
|
|
// Module Federation groundwork as shell. No remotes yet; does not change behavior.
|
|
federation({
|
|
name: 'dashboard-shell',
|
|
filename: 'remoteEntry.js',
|
|
exposes: {
|
|
// You can expose shared UI/components later if needed
|
|
},
|
|
remotes: {
|
|
// Allow overriding by env; default to localhost for dev
|
|
videoRemote: process.env.VITE_VIDEO_REMOTE_URL || 'http://localhost:3001/assets/remoteEntry.js',
|
|
visionSystemRemote: process.env.VITE_VISION_SYSTEM_REMOTE_URL || 'http://localhost:3002/assets/remoteEntry.js',
|
|
schedulingRemote: process.env.VITE_SCHEDULING_REMOTE_URL || 'http://localhost:3003/assets/remoteEntry.js'
|
|
},
|
|
shared: {
|
|
react: { singleton: true, eager: true },
|
|
'react-dom': { singleton: true, eager: true },
|
|
},
|
|
})
|
|
],
|
|
server: {
|
|
// Allow connections from the VM hostname and any other host/IP
|
|
allowedHosts: ['exp-dash', 'localhost', 'usda-dash.ugaif.com'],
|
|
// Proxy API calls from the browser to the API container via the compose service name
|
|
proxy: {
|
|
'/api': {
|
|
// Route to API via the host so this works whether API is on bridge (via port mapping) or host network
|
|
target: 'http://host.docker.internal:8000',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
},
|
|
'/media-api': {
|
|
// Proxy media-api requests to the media-api container
|
|
target: 'http://host.docker.internal:8090',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/media-api/, ''),
|
|
},
|
|
},
|
|
},
|
|
})
|