Files
tms-erp-web/vite.config.mjs
赵忠林 f03f764472 feat(dispatch): 优化运输计划调度弹窗视觉布局并提升紧凑度
- 弹窗标题和单号合并一行,移除分隔符,提升信息整体感
- 基本信息和收发货路线由左右双列改为上下堆叠,改善视觉层次
- 基本信息网格调整为4列布局,货物信息扩大占2列,附件独占一行
- 计划执行时间范围由‘-’改为‘ ~ ’,更清晰表达时间区间
- 路线节点展示改为横向徽章加下方双列详细信息,避免空白和居中留白
- 调整字体大小、颜色及间距,整体风格更简洁且信息更紧凑
- 移除无用边距和min-height约束,使弹窗整体更加紧凑精简
- 更新代理配置,开发期/api请求代理指向指定内网地址,统一路径无需重写,
  以解决跨域问题并保持与后端网关路径一致
- 进行了完整构建验证,确保修改不会影响现有功能稳定性
2026-08-06 19:53:34 +08:00

99 lines
2.5 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,
// },
// },
// },
server: {
port: 2888,
proxy: {
// 开发期同源代理:浏览器请求 /api/xxx -> 由 Vite 转发到 http://172.16.203.228:8000/api/xxx
// 必须保留 /api 前缀(不要 rewrite 去掉),与 openresty/nginx 期望的路径一致,从而规避跨域(CORS)问题
'/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',
},
},
});
};