-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
47 lines (45 loc) · 1.21 KB
/
vite.config.ts
File metadata and controls
47 lines (45 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import federation from '@originjs/vite-plugin-federation';
const isDev = process.env.NODE_ENV !== 'production';
export default defineConfig({
plugins: [
sveltekit(),
// Module Federation for loading external apps
...(isDev ? [federation({
name: 'desktopHost',
remotes: {
// Federation remotes - these apps need to be running for federation to work
'excalidraw-remote': 'http://localhost:5004/assets/remoteEntry.js',
},
// Don't share React - let remotes bundle their own version
shared: [],
})] : []),
],
server: {
port: 5176,
strictPort: false,
cors: true,
fs: {
// Allow serving files from the plugins directory
allow: ['src', 'plugins', 'node_modules', '.svelte-kit'],
},
proxy: {
// Proxy federation remotes to avoid CORS issues
'/federation/excalidraw': {
target: 'http://localhost:5004',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/federation\/excalidraw/, ''),
},
},
},
build: {
target: 'esnext',
rollupOptions: {
// Externalize federation remotes for production build
external: isDev ? [] : [
'excalidraw-remote/Excalidraw',
],
},
},
});