Grade_Inquiry/vite.config.ts
2026-01-26 16:43:55 +08:00

40 lines
844 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 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'],
},
})