38 lines
792 B
JavaScript
38 lines
792 B
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import legacy from '@vitejs/plugin-legacy'
|
|
import path from 'path'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
legacy({
|
|
targets: ['chrome >= 64', 'safari >= 11', 'ios >= 11', 'android >= 9'],
|
|
additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
|
|
modernPolyfills: true,
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
open: true,
|
|
proxy: {
|
|
// 代理API请求到后端
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: false,
|
|
},
|
|
})
|