2024-12-02 00:05:10 +08:00
|
|
|
|
const { defineConfig } = require("@vue/cli-service");
|
|
|
|
|
const WebpackObfuscator = require("webpack-obfuscator");
|
|
|
|
|
const path = require("path");
|
|
|
|
|
function resolve(dir) {
|
|
|
|
|
return path.join(__dirname, "./", dir);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-27 23:42:39 +08:00
|
|
|
|
module.exports = defineConfig({
|
|
|
|
|
transpileDependencies: true,
|
2024-12-02 00:05:10 +08:00
|
|
|
|
publicPath: "/xdbs",
|
|
|
|
|
productionSourceMap: false,
|
2024-11-27 23:42:39 +08:00
|
|
|
|
devServer: {
|
2024-12-02 00:05:10 +08:00
|
|
|
|
host: "0.0.0.0",
|
2024-11-27 23:42:39 +08:00
|
|
|
|
port: 3000,
|
|
|
|
|
open: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
// https://cn.vitejs.dev/config/#server-proxy
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"/dev-api": {
|
2025-06-03 01:11:27 +08:00
|
|
|
|
//target: "http://localhost:8080",
|
|
|
|
|
target: 'http://62.234.3.186/prod-api/',
|
2024-11-27 23:42:39 +08:00
|
|
|
|
changeOrigin: true,
|
|
|
|
|
pathRewrite: {
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"^/dev-api": "/",
|
|
|
|
|
},
|
2024-11-27 23:42:39 +08:00
|
|
|
|
},
|
2025-01-05 22:46:53 +08:00
|
|
|
|
"/prod-api": {
|
|
|
|
|
//target: "http://localhost:8080",
|
|
|
|
|
target: 'http://62.234.3.186/prod-api/',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
pathRewrite: {
|
|
|
|
|
"^/prod-api": "/",
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"/xd/": {
|
2025-01-05 22:46:53 +08:00
|
|
|
|
//target: "http://localhost/xd",
|
|
|
|
|
target: 'http://62.234.3.186/xd/',
|
2024-11-27 23:42:39 +08:00
|
|
|
|
changeOrigin: true,
|
|
|
|
|
pathRewrite: {
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"^/xd/": "/",
|
|
|
|
|
},
|
2024-11-27 23:42:39 +08:00
|
|
|
|
},
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"/cesium": {
|
2024-11-27 23:42:39 +08:00
|
|
|
|
target: `http://62.234.3.186/cesium/`,
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
pathRewrite: {
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"^/cesium": "/",
|
|
|
|
|
},
|
2024-11-27 23:42:39 +08:00
|
|
|
|
},
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"/cdn": {
|
2024-11-27 23:42:39 +08:00
|
|
|
|
target: `http://62.234.3.186/cdn/`,
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
pathRewrite: {
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"^/cdn": "/",
|
|
|
|
|
},
|
2024-11-27 23:42:39 +08:00
|
|
|
|
},
|
2024-12-02 00:05:10 +08:00
|
|
|
|
"/statics/": {
|
2025-01-05 22:46:53 +08:00
|
|
|
|
//target: `http://localhost:9300/statics/`,
|
|
|
|
|
target: `http://62.234.3.186/statics/`,
|
2024-11-27 23:42:39 +08:00
|
|
|
|
changeOrigin: true,
|
2024-12-02 00:05:10 +08:00
|
|
|
|
pathRewrite: {
|
|
|
|
|
"^/statics/": "/",
|
|
|
|
|
},
|
2024-11-27 23:42:39 +08:00
|
|
|
|
},
|
2024-12-02 00:05:10 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
chainWebpack: (config) => {
|
|
|
|
|
config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
|
|
|
|
|
config.module
|
|
|
|
|
.rule("icons")
|
|
|
|
|
.test(/\.svg$/)
|
|
|
|
|
.include.add(resolve("src/assets/icons"))
|
|
|
|
|
.end()
|
|
|
|
|
.use("svg-sprite-loader")
|
|
|
|
|
.loader("svg-sprite-loader")
|
|
|
|
|
.options({
|
|
|
|
|
symbolId: "myicon-[name]",
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
configureWebpack: (config) => {
|
|
|
|
|
config.externals = {
|
|
|
|
|
vue: "Vue",
|
|
|
|
|
};
|
|
|
|
|
if (process.env.NODE_ENV === "production") {
|
2024-12-15 23:38:24 +08:00
|
|
|
|
/*
|
2024-11-27 23:42:39 +08:00
|
|
|
|
config.plugins.push(
|
|
|
|
|
new WebpackObfuscator(
|
|
|
|
|
{
|
|
|
|
|
rotateStringArray: true, // 旋转字符串数组
|
|
|
|
|
stringArray: true, // 使用字符串数组
|
2024-12-02 00:05:10 +08:00
|
|
|
|
stringArrayEncoding: ["rc4"], // 字符串数组编码(rc4 是一个强加密算法)
|
2024-11-27 23:42:39 +08:00
|
|
|
|
stringArrayThreshold: 0.75, // 混淆代码中的字符串百分比
|
|
|
|
|
deadCodeInjection: true, // 注入死代码
|
|
|
|
|
deadCodeInjectionThreshold: 0.4, // 死代码注入比例
|
|
|
|
|
unicodeEscapeSequence: false, // 使用Unicode转义序列
|
|
|
|
|
debugProtection: true, // 防止浏览器的开发者工具调试
|
|
|
|
|
disableConsoleOutput: true, // 禁用 console.log、console.info 等输出
|
|
|
|
|
},
|
|
|
|
|
[] // 需要排除混淆的文件
|
|
|
|
|
)
|
2024-12-02 00:05:10 +08:00
|
|
|
|
);
|
2024-12-15 23:38:24 +08:00
|
|
|
|
*/
|
2024-11-27 23:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-12-02 00:05:10 +08:00
|
|
|
|
});
|