配置vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig(({ command, mode }) => {
//const env = loadEnv(mode, process.cwd(), '') //获取环境变量
return {
// 打包dev
base: './',
// 开发环境
server: {
port: 5002,
host: true, //'0.0.0.0'
open: false,
strictPort: true
},
//预览环境
preview: {
port: 5002,
host: true, //'0.0.0.0'
},
plugins: [vue()]
}
})