40 lines
844 B
TypeScript
40 lines
844 B
TypeScript
/**
|
||
* Vite 配置文件
|
||
* 用于配置开发服务器、构建选项和插件
|
||
*/
|
||
import { defineConfig } from 'vite'
|
||
import vue from '@vitejs/plugin-vue'
|
||
import { resolve } from 'path'
|
||
|
||
export default defineConfig({
|
||
plugins: [vue()],
|
||
resolve: {
|
||
alias: {
|
||
'@': resolve(__dirname, 'src'),
|
||
},
|
||
},
|
||
// 开发服务器配置
|
||
server: {
|
||
port: 3000,
|
||
host: true,
|
||
// 配置代理(如需要连接后端API)
|
||
// proxy: {
|
||
// '/api': {
|
||
// target: 'http://localhost:8080',
|
||
// changeOrigin: true,
|
||
// },
|
||
// },
|
||
},
|
||
// 构建配置
|
||
build: {
|
||
outDir: 'dist',
|
||
assetsDir: 'assets',
|
||
// 使用 esbuild 进行压缩(默认,无需额外安装)
|
||
minify: 'esbuild',
|
||
},
|
||
// 生产环境移除 console 和 debugger
|
||
esbuild: {
|
||
drop: ['console', 'debugger'],
|
||
},
|
||
})
|