Files
tms-erp-web/vite.config.mjs
T
gxwebsoft 559d8e7391 style(customer-archive): 优化编辑弹窗表单布局和样式
- 将 el-form 的 label-width 固定为 96px,保证标签宽度统一
- 调整 form 各部分 gutter 为 24,使列间距更均匀
- 联系信息分组布局由三列改为四列,与其他分组对齐
- 提升 label 支持自动换行,解决长标签截断问题
- 在全局样式中新添弹窗内自定义分组白卡样式,提升 Avue 弹窗穿透稳定性
- 修改代理配置中的 target 地址指向内网服务器
- 清理业务弹窗表格边框,移除多余 border 属性及样式
2026-08-11 11:06:47 +08:00

97 lines
2.2 KiB
JavaScript

import {
defineConfig,
loadEnv
} from 'vite';
import { resolve } from 'path'
import createVitePlugins from './vite/plugins';
// https://vitejs.dev/config/
export default ({
mode,
command
}) => {
const env = loadEnv(mode, process.cwd())
const {
VITE_APP_ENV,
VITE_APP_BASE
} = env
// 判断是打生产环境包
const isProd = VITE_APP_ENV === 'production'
// 根据是否生产环境,动态设置压缩配置
const buildConfig = {
target: 'esnext',
minify: isProd ? 'terser' : 'esbuild', // 根据环境选择压缩工具
};
// 如果是生产环境,添加Terser的配置
if (isProd) {
buildConfig.terserOptions = {
compress: {
drop_console: true, // 删除 console
drop_debugger: true, // 删除 debugger
},
format: {
comments: false // 删除所有注释
}
};
buildConfig.rollupOptions = {
output: {
manualChunks: {
'element-plus': ['element-plus'],
'@smallwei/avue': ['@smallwei/avue']
},
}
}
}
return defineConfig({
base: VITE_APP_BASE,
define: {
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: true,
__INTLIFY_PROD_DEVTOOLS__: false,
},
// server: {
// port: 2888,
// proxy: {
// '/api': {
// target: 'http://172.16.203.228:8000',
// changeOrigin: true,
// },
// },
// },
server: {
port: 2888,
proxy: {
'/api': {
target: 'http://172.16.203.228:8000',
changeOrigin: true,
},
},
},
resolve: {
alias: {
'~': resolve(__dirname, './'),
'@': resolve(__dirname, './src'),
components: resolve(__dirname, './src/components'),
styles: resolve(__dirname, './src/styles'),
utils: resolve(__dirname, './src/utils'),
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
additionalData: `@use "@/styles/variables.scss" as *;`,
},
},
},
plugins: createVitePlugins(env, command === 'build'),
build: buildConfig,
optimizeDeps: {
esbuildOptions: {
target: 'esnext',
},
},
});
};