You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
797 B
34 lines
797 B
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ mode, command }) => {
|
|
// 根据模式设置不同的输出目录
|
|
const outDirMap = {
|
|
development: 'dist-test', // 测试环境
|
|
product: 'dist-prod' // 生产环境
|
|
}
|
|
|
|
return {
|
|
plugins: [
|
|
vue(),
|
|
vueDevTools(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
},
|
|
},
|
|
build: {
|
|
// 根据模式设置不同的输出目录
|
|
outDir: outDirMap[mode] || 'dist',
|
|
},
|
|
// 开发服务器配置
|
|
server: {
|
|
port: 5173,
|
|
open: true
|
|
}
|
|
}
|
|
})
|