6de87ed4e2
- 调整合同管理备注输入框行数和最大长度 - 细化合同变更页面表单项间距和对齐方式 - 统一弹窗表单项的底部间距样式,改为注释禁用 - 调整 port-terminal 和 region 组件的表单项底部间距 - 修改 vite 配置中 API 请求代理地址 - 优化凭证执行详情搜索表单列宽布局 - 在运单管理页面更新型号字段为非必填,调整变更记录内容格式化显示 - 引入并使用 formatRouteChangeContent 工具函数 - 统一明细按钮显示逻辑,草稿状态也显示详情按钮 - 新增路由变更相关工具函数与样式支持
102 lines
3.1 KiB
JavaScript
102 lines
3.1 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 assetFileNames = assetInfo => {
|
|
const fileName = assetInfo.names?.[0] || assetInfo.name || '';
|
|
return fileName.endsWith('.mjs') ? 'assets/[name]-[hash].js' : 'assets/[name]-[hash][extname]';
|
|
};
|
|
|
|
// 根据是否生产环境,动态设置压缩配置
|
|
const buildConfig = {
|
|
target: 'esnext',
|
|
minify: isProd ? 'terser' : 'esbuild', // 根据环境选择压缩工具
|
|
rollupOptions: {
|
|
output: {
|
|
assetFileNames,
|
|
},
|
|
},
|
|
};
|
|
|
|
// 如果是生产环境,添加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': {
|
|
// // 本地网关默认 80 端口(blade-gateway bootstrap.yml);开发时需先启动网关及 blade-auth/blade-system 等服务
|
|
// // 注意:本机 8080 一般是 Nacos,不是业务网关
|
|
// target: 'http://localhost',
|
|
// // target: 'http://172.16.203.228:8000', // 仅联调远程网关时启用(且不要 rewrite)
|
|
// changeOrigin: true,
|
|
// rewrite: path => path.replace(/^\/api/, ''),
|
|
// },
|
|
// },
|
|
// },
|
|
server: {
|
|
port: 2889,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://172.16.203.221: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: {
|
|
// vue-pdf-embed is loaded on demand by the PDF preview component. Keeping
|
|
// it out of the shared dependency bundle avoids stale Vue chunk cycles
|
|
// when the development dependency cache is refreshed.
|
|
exclude: ['vue-pdf-embed'],
|
|
esbuildOptions: {
|
|
target: 'esnext',
|
|
},
|
|
},
|
|
});
|
|
};
|