48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
/**
|
|
* admin.nomadro.com — Web only; isolated from apps/admin (.cn)
|
|
* 本地默认连接 .com 线上后端,与门户保持一致。
|
|
* 仅显式联调时通过 VITE_DEV_API 覆盖。
|
|
*/
|
|
const DEV_API = process.env.VITE_DEV_API?.trim() || 'https://nomadro.com'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
port: 5174,
|
|
proxy: {
|
|
'/api': {
|
|
target: DEV_API,
|
|
changeOrigin: true,
|
|
secure: true,
|
|
},
|
|
'/health': {
|
|
target: DEV_API,
|
|
changeOrigin: true,
|
|
secure: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
target: 'es2020',
|
|
cssCodeSplit: true,
|
|
modulePreload: { polyfill: true },
|
|
reportCompressedSize: false,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (!id.includes('node_modules')) return
|
|
if (id.includes('react-router')) return 'router'
|
|
if (id.includes('react-dom') || id.includes('/react/')) return 'react'
|
|
},
|
|
},
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
include: ['react', 'react-dom', 'react-router-dom'],
|
|
},
|
|
})
|