forked from sagnik/Velocity-OS
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
|
|
/**
|
|
* Velocity-OS — Vite Configuration
|
|
* Dev server proxies /api and /ws to core-api on port 8443.
|
|
* Production build output: dist/ (served by Nginx in Docker).
|
|
*/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
|
|
server: {
|
|
port: 3000,
|
|
host: true,
|
|
proxy: {
|
|
// REST API → core-api
|
|
'/api': {
|
|
target: 'http://localhost:8443',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
// WebSocket → core-api
|
|
'/ws': {
|
|
target: 'ws://localhost:8443',
|
|
ws: true,
|
|
changeOrigin: true,
|
|
},
|
|
// Dream Weaver gateway
|
|
'/dream-weaver': {
|
|
target: 'http://localhost:8290',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: false, // no source maps in production build
|
|
minify: 'esbuild',
|
|
rollupOptions: {
|
|
output: {
|
|
// Content-hash filenames for immutable caching
|
|
entryFileNames: 'assets/[name].[hash].js',
|
|
chunkFileNames: 'assets/[name].[hash].js',
|
|
assetFileNames: 'assets/[name].[hash].[ext]',
|
|
// Manual chunks to keep vendor bundle separate
|
|
manualChunks: {
|
|
'vendor-react': ['react', 'react-dom', 'react-router-dom'],
|
|
'vendor-motion': ['framer-motion'],
|
|
'vendor-three': ['three', '@react-three/fiber', '@react-three/drei'],
|
|
'vendor-query': ['@tanstack/react-query'],
|
|
'vendor-zustand': ['zustand'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
optimizeDeps: {
|
|
include: ['react', 'react-dom', 'framer-motion', 'zustand', '@tanstack/react-query'],
|
|
},
|
|
});
|