Jpom/web-vue/vue.config.js

79 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-11-01 19:37:30 +08:00
// vue.config.js
2023-02-28 18:56:10 +08:00
const HOST = process.env.proxy_host;
console.log(process.env.proxy_host, HOST);
const Timestamp = new Date().getTime();
2022-02-08 10:01:13 +08:00
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2020-11-01 19:37:30 +08:00
module.exports = {
// 输出目录
outputDir: "../modules/server/src/main/resources/dist",
2021-03-02 13:01:54 +08:00
// 控制静态资源使用相对路径
publicPath: "./",
2020-11-02 12:00:39 +08:00
// 代理设置
devServer: {
port: 3000,
2020-12-01 18:42:53 +08:00
proxy: {
// websocket
"/ssh": {
target: `wss://${HOST}`,
2020-12-01 18:42:53 +08:00
// true/false: if you want to proxy websockets
ws: false,
secure: false,
2020-12-01 18:42:53 +08:00
},
"/tomcat_log": {
target: `wss://${HOST}`,
2020-12-03 11:56:49 +08:00
// true/false: if you want to proxy websockets
ws: false,
secure: false,
2020-12-03 11:56:49 +08:00
},
"/console": {
target: `wss://${HOST}`,
2020-12-17 16:43:20 +08:00
// true/false: if you want to proxy websockets
ws: false,
secure: false,
2020-12-17 16:43:20 +08:00
},
"/script_run": {
target: `wss://${HOST}`,
2021-02-24 18:25:08 +08:00
// true/false: if you want to proxy websockets
ws: false,
secure: false,
},
2020-12-01 18:42:53 +08:00
// http
"/*": {
target: `http://${HOST}`,
timeout: 10 * 60 * 1000,
},
},
},
//打包后是否让每个js文件都生成一个.map文件true代表生成false代表不生成。
productionSourceMap: false,
configureWebpack: {
// name: name,
// 修改打包后的js文件名称
output: {
// 输出重构 打包编译后的 文件名称 【模块名称.版本号.时间戳】
filename: `js/[name].[hash].${Timestamp}.js`,
chunkFilename: `js/[name].[hash].${Timestamp}.js`,
},
// 修改打包后的css文件名称
plugins: [
new MiniCssExtractPlugin({
filename: `css/[name].[contenthash].${Timestamp}.css`,
}),
],
// resolve: {
// alias: {
// "@": resolve("src")
// }
// }
},
chainWebpack: (config) => {
config.plugin("html").tap((args) => {
args[0].title = "Jpom项目管理系统";
args[0].build = new Date().getTime();
2022-02-08 10:01:13 +08:00
args[0].env = process.env.NODE_ENV;
2022-11-25 23:41:45 +08:00
args[0].buildVersion = process.env.npm_package_version;
return args;
});
2020-11-02 22:29:57 +08:00
},
};