76 lines
2.1 KiB
JavaScript
76 lines
2.1 KiB
JavaScript
|
const { defineConfig } = require('@vue/cli-service')
|
|||
|
const WebpackObfuscator = require('webpack-obfuscator')
|
|||
|
module.exports = defineConfig({
|
|||
|
transpileDependencies: true,
|
|||
|
publicPath :'/xdbs' ,
|
|||
|
productionSourceMap:false,
|
|||
|
devServer: {
|
|||
|
host: '0.0.0.0',
|
|||
|
port: 3000,
|
|||
|
open: true,
|
|||
|
proxy: {
|
|||
|
// https://cn.vitejs.dev/config/#server-proxy
|
|||
|
'/dev-api': {
|
|||
|
target: 'http://localhost:8080',
|
|||
|
//target: 'http://62.234.3.186/prod-api/',
|
|||
|
changeOrigin: true,
|
|||
|
pathRewrite: {
|
|||
|
'^/dev-api':'/'
|
|||
|
}
|
|||
|
},
|
|||
|
'/xd/': {
|
|||
|
target: 'http://localhost/xd',
|
|||
|
changeOrigin: true,
|
|||
|
pathRewrite: {
|
|||
|
'^/xd/':'/'
|
|||
|
}
|
|||
|
},
|
|||
|
'/cesium':{
|
|||
|
target: `http://62.234.3.186/cesium/`,
|
|||
|
changeOrigin: true,
|
|||
|
pathRewrite: {
|
|||
|
'^/cesium':'/'
|
|||
|
}
|
|||
|
},
|
|||
|
'/cdn':{
|
|||
|
target: `http://62.234.3.186/cdn/`,
|
|||
|
changeOrigin: true,
|
|||
|
pathRewrite: {
|
|||
|
'^/cdn':'/'
|
|||
|
}
|
|||
|
},
|
|||
|
'/statics': {
|
|||
|
target: `http://localhost:9300/statics/`,
|
|||
|
changeOrigin: true,
|
|||
|
rewrite: (p) => p.replace(/^\/statics/, '')
|
|||
|
},
|
|||
|
|
|||
|
}
|
|||
|
},
|
|||
|
|
|||
|
configureWebpack:(config)=>{
|
|||
|
config.externals={
|
|||
|
'vue':"Vue"
|
|||
|
}
|
|||
|
if (process.env.NODE_ENV === 'production') {
|
|||
|
config.plugins.push(
|
|||
|
new WebpackObfuscator(
|
|||
|
{
|
|||
|
rotateStringArray: true, // 旋转字符串数组
|
|||
|
stringArray: true, // 使用字符串数组
|
|||
|
stringArrayEncoding: ['rc4'], // 字符串数组编码(rc4 是一个强加密算法)
|
|||
|
stringArrayThreshold: 0.75, // 混淆代码中的字符串百分比
|
|||
|
deadCodeInjection: true, // 注入死代码
|
|||
|
deadCodeInjectionThreshold: 0.4, // 死代码注入比例
|
|||
|
unicodeEscapeSequence: false, // 使用Unicode转义序列
|
|||
|
debugProtection: true, // 防止浏览器的开发者工具调试
|
|||
|
disableConsoleOutput: true, // 禁用 console.log、console.info 等输出
|
|||
|
},
|
|||
|
[] // 需要排除混淆的文件
|
|||
|
)
|
|||
|
)
|
|||
|
}
|
|||
|
},
|
|||
|
|
|||
|
})
|