Files
tms-erp-web/vite.config.mjs
赵忠林 e76cf70a20 feat(cargo-type): 优化货物类型导入失败明细的错误标记和提示
- 新增导入失败明细的加工函数,给违规字段自动标红并丰富错误提示信息
- 在导入弹窗调用中增加失败明细装饰器处理,提升用户体验
- 将货物类型组件option配置提取为单独模块,简化代码逻辑
- 调整货物类型表单禁用逻辑,避免非新增时的错误操作
- 移除原有表单校验函数,相关验证由导入失败明细装饰器替代
- 引入exceljs依赖以支持导入失败Excel文件的读取和修改
- 修复导入失败明细导出时的文件命名和内容加工问题
- 优化代码结构,提升维护性和可读性
2026-07-27 23:58:29 +08:00

88 lines
2.0 KiB
JavaScript
Raw 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.

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,
},
},
},
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',
},
},
});
};