update
This commit is contained in:
@@ -1,19 +1,51 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ command }) => ({
|
||||
plugins: [react()],
|
||||
server:{
|
||||
proxy:{
|
||||
//此处编写代理规则
|
||||
"/api":{
|
||||
target:"http://localhost:8080",
|
||||
changeOrigin:true,
|
||||
rewrite:path=>{
|
||||
return path.replace(/\/api/,'api/');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
resolve: {
|
||||
// new URL is pure ESM — no __dirname needed, no @types/node required
|
||||
alias: { '@': new URL('./src', import.meta.url).pathname },
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
api: 'modern-compiler',
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
// no rewrite: /api/... proxied as-is to http://localhost:8080/api/...
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
lexical: [
|
||||
'lexical',
|
||||
'@lexical/react',
|
||||
'@lexical/rich-text',
|
||||
'@lexical/list',
|
||||
'@lexical/code',
|
||||
'@lexical/table',
|
||||
],
|
||||
semi: ['@douyinfe/semi-ui', '@douyinfe/semi-icons'],
|
||||
excalidraw: ['@excalidraw/excalidraw'],
|
||||
vendor: ['react', 'react-dom', 'react-router', 'axios'],
|
||||
yjs: ['yjs', 'y-websocket'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
esbuild: {
|
||||
// strip console.* and debugger in production builds
|
||||
drop: command === 'build' ? (['console', 'debugger'] as const) : [],
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user