- Add Express server with vite-express for combined frontend/API serving - Create modular API route structure (server/api/) - Implement Claude API proxy with proper header injection - Support split deployment via API_ONLY and ALLOWED_ORIGINS env vars - Remove Claude proxy from Vite config (now handled by Express) - Add migration plan documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
/// <reference types="vitest" />
|
|
import {defineConfig, loadEnv} from "vite";
|
|
|
|
/** @type {import('vite').UserConfig} */
|
|
export default defineConfig(({mode}) => {
|
|
const env = loadEnv(mode, process.cwd(), '');
|
|
return {
|
|
test: {},
|
|
define: {},
|
|
build: {
|
|
sourcemap: true,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
'babylon': ['@babylonjs/core']
|
|
}
|
|
}
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
esbuildOptions: {
|
|
define: {
|
|
global: 'window',
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
allowedHosts: true,
|
|
port: 3001,
|
|
proxy: {
|
|
'^/sync/.*': {
|
|
target: 'https://www.deepdiagram.com/',
|
|
changeOrigin: true,
|
|
},
|
|
'^/create-db': {
|
|
target: 'https://www.deepdiagram.com/',
|
|
changeOrigin: true,
|
|
},
|
|
'^/api/images': {
|
|
target: 'https://www.deepdiagram.com/',
|
|
changeOrigin: true,
|
|
}
|
|
// /api/claude is now handled by Express server
|
|
}
|
|
|
|
},
|
|
preview: {
|
|
port: 3001,
|
|
proxy: {
|
|
'^/sync/.*': {
|
|
target: 'https://www.deepdiagram.com/',
|
|
changeOrigin: true,
|
|
},
|
|
'^/create-db': {
|
|
target: 'https://www.deepdiagram.com/',
|
|
changeOrigin: true,
|
|
},
|
|
'^/api/images': {
|
|
target: 'https://www.deepdiagram.com/',
|
|
changeOrigin: true,
|
|
}
|
|
// /api/claude is now handled by Express server
|
|
}
|
|
},
|
|
base: "/"
|
|
};
|
|
}); |