26 lines
617 B
TypeScript
26 lines
617 B
TypeScript
|
|
import { defineConfig } from 'vite'
|
||
|
|
import react from '@vitejs/plugin-react'
|
||
|
|
import path from 'path'
|
||
|
|
|
||
|
|
// https://vite.dev/config/
|
||
|
|
export default defineConfig({
|
||
|
|
resolve: {
|
||
|
|
alias: {
|
||
|
|
react: path.resolve(__dirname, 'node_modules/react'),
|
||
|
|
'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
plugins: [react()],
|
||
|
|
server: {
|
||
|
|
host: '0.0.0.0', // 监听所有网络接口,支持局域网访问
|
||
|
|
port: 5173,
|
||
|
|
// 开发环境代理配置(可选)
|
||
|
|
proxy: {
|
||
|
|
'/api': {
|
||
|
|
target: 'http://127.0.0.1:8000',
|
||
|
|
changeOrigin: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
})
|