You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteMockPlugin } from './mock/plugin'
import path from 'path'
// https://vite.dev/config/
export default defineConfig ( ( { command } ) = > ( {
// build时部署到/admin/子路径, dev时用根路径
base : command === 'build' ? '/admin/' : '/' ,
plugins : [
vue ( ) ,
viteMockPlugin ( {
mockPath : 'mock' ,
enable : true ,
} ) ,
] ,
resolve : {
alias : {
'@' : path . resolve ( __dirname , 'src' ) ,
} ,
} ,
server : {
port : 5173 ,
} ,
// 构建优化配置
build : {
// 输出到 CncWebApi/admin 目录, IIS 直接服务
outDir : path.resolve ( __dirname , '../src/CncWebApi/admin' ) ,
// 不清空目标目录(避免删除其他文件)
emptyOutDir : true ,
rollupOptions : {
output : {
// Vite 8 (Rolldown) 使用 codeSplitting 替代 manualChunks
codeSplitting : true ,
}
}
} ,
} ) )