2024-05-11 09:53:05 +08:00
|
|
|
|
import { defineApplicationConfig } from '@vben/vite-config';
|
2025-12-30 13:49:06 +08:00
|
|
|
|
import { viteObfuscateFile } from 'vite-plugin-obfuscator';
|
2024-05-11 09:53:05 +08:00
|
|
|
|
|
|
|
|
|
|
export default defineApplicationConfig({
|
|
|
|
|
|
overrides: {
|
|
|
|
|
|
optimizeDeps: {
|
|
|
|
|
|
include: [
|
|
|
|
|
|
'echarts/core',
|
|
|
|
|
|
'echarts/charts',
|
|
|
|
|
|
'echarts/components',
|
|
|
|
|
|
'echarts/renderers',
|
|
|
|
|
|
'qrcode',
|
|
|
|
|
|
'@iconify/iconify',
|
|
|
|
|
|
'ant-design-vue/es/locale/zh_CN',
|
|
|
|
|
|
'ant-design-vue/es/locale/en_US',
|
|
|
|
|
|
'@/../lib/vform/designer.umd.js',
|
|
|
|
|
|
],
|
|
|
|
|
|
},
|
|
|
|
|
|
build: {
|
|
|
|
|
|
/* 其他build生产打包配置省略 */
|
|
|
|
|
|
//...
|
|
|
|
|
|
target: 'esnext',
|
2025-12-30 13:49:06 +08:00
|
|
|
|
// chunkSizeWarningLimit:1500,
|
2024-05-11 09:53:05 +08:00
|
|
|
|
commonjsOptions: {
|
|
|
|
|
|
include: /node_modules|lib/, //这里记得把lib目录加进来,否则生产打包会报错!!
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
server: {
|
|
|
|
|
|
proxy: {
|
|
|
|
|
|
'/basic-api': {
|
|
|
|
|
|
target: 'http://localhost:3000',
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
ws: true,
|
|
|
|
|
|
rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),
|
|
|
|
|
|
// only https
|
|
|
|
|
|
// secure: false
|
|
|
|
|
|
},
|
|
|
|
|
|
'/upload': {
|
|
|
|
|
|
target: 'http://localhost:3300/upload',
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
ws: true,
|
|
|
|
|
|
rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
warmup: {
|
|
|
|
|
|
clientFiles: ['./index.html', './src/{views,components}/*'],
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
define: {
|
|
|
|
|
|
'process.env': {
|
|
|
|
|
|
BASE_URL: '/',
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
css: {
|
|
|
|
|
|
preprocessorOptions: {
|
|
|
|
|
|
less: {
|
|
|
|
|
|
javascriptEnabled: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2025-12-30 13:49:06 +08:00
|
|
|
|
plugins: [
|
|
|
|
|
|
viteObfuscateFile({
|
|
|
|
|
|
// 配置选项-混淆选项
|
|
|
|
|
|
compact: true, // 压缩代码
|
|
|
|
|
|
controlFlowFlattening: true, // 控制流扁平化
|
|
|
|
|
|
deadCodeInjection: true, // 死代码注入 会导致包体积变大
|
|
|
|
|
|
debugProtection: true, // 调试保护
|
|
|
|
|
|
debugProtectionInterval: 0, // 调试保护间隔
|
|
|
|
|
|
disableConsoleOutput: true, // 禁用控制台输出
|
|
|
|
|
|
identifierNamesGenerator: 'hexadecimal', // 标识符名称生成器
|
|
|
|
|
|
log: false, // 是否显示日志
|
|
|
|
|
|
numbersToExpressions: true, // 数字转换为表达式
|
|
|
|
|
|
renameGlobals: true, // 重命名全局变量
|
|
|
|
|
|
selfDefending: true, // 自我防御
|
|
|
|
|
|
simplify: true, // 简化代码
|
|
|
|
|
|
splitStrings: true, // 分割字符串
|
|
|
|
|
|
stringArray: true, // 字符串数组
|
|
|
|
|
|
stringArrayEncoding: ['rc4'], // 字符串数组编码
|
|
|
|
|
|
stringArrayThreshold: 0.75, // 字符串数组阈值
|
|
|
|
|
|
transformObjectKeys: true, // 转换对象键
|
|
|
|
|
|
unicodeEscapeSequence: true, // Unicode 转义序列
|
|
|
|
|
|
}),
|
|
|
|
|
|
],
|
2024-05-11 09:53:05 +08:00
|
|
|
|
},
|
|
|
|
|
|
});
|