2022-11-10 09:18:38 +08:00
|
|
|
const path = require("path");
|
2022-06-08 14:51:11 +08:00
|
|
|
// 代码压缩
|
|
|
|
|
const TerserPlugin = require("terser-webpack-plugin");
|
2022-11-10 09:18:38 +08:00
|
|
|
function addStyleResource(rule) {
|
|
|
|
|
rule
|
|
|
|
|
.use("style-resource")
|
|
|
|
|
.loader("style-resources-loader")
|
2022-06-08 14:51:11 +08:00
|
|
|
.options({
|
|
|
|
|
patterns: [
|
2022-11-10 09:18:38 +08:00
|
|
|
path.resolve(__dirname, "src/assets/style/var.less"), //全局引入的less文件
|
|
|
|
|
path.resolve(__dirname, "src/assets/style/longguang.less"), //全局引入的less文件--龙光地产
|
2022-06-08 14:51:11 +08:00
|
|
|
],
|
2022-11-10 09:18:38 +08:00
|
|
|
});
|
2022-06-08 14:51:11 +08:00
|
|
|
}
|
|
|
|
|
module.exports = {
|
2023-06-19 18:22:36 +08:00
|
|
|
// publicPath: process.env.NODE_ENV === "production" ? "/jxjgd" : "/jxjgd",//金林湾配置
|
2022-06-08 14:51:11 +08:00
|
|
|
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
2022-11-10 09:18:38 +08:00
|
|
|
devServer: {
|
2022-10-26 10:56:31 +08:00
|
|
|
// host: 'localhost',
|
2022-11-10 09:18:38 +08:00
|
|
|
proxy: {
|
|
|
|
|
"/china": {
|
2022-07-22 15:53:09 +08:00
|
|
|
target: "http://122.112.239.62:9000",
|
2022-11-10 09:18:38 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
pathRewrite: {
|
|
|
|
|
"^/china": "", //重写路径
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-07-22 15:53:09 +08:00
|
|
|
},
|
2022-11-10 09:18:38 +08:00
|
|
|
pages: {
|
2022-06-08 14:51:11 +08:00
|
|
|
index: {
|
|
|
|
|
entry: "./src/pages/index/index.js",
|
|
|
|
|
template: "./src/pages/index/index.html",
|
|
|
|
|
filename: "index.html",
|
2022-11-10 09:18:38 +08:00
|
|
|
title: "机械设备管理平台",
|
2022-06-08 14:51:11 +08:00
|
|
|
},
|
|
|
|
|
equipmentCenter: {
|
|
|
|
|
entry: "./src/pages/equipmentCenter/equipmentCenter.js",
|
|
|
|
|
template: "./src/pages/equipmentCenter/equipmentCenter.html",
|
|
|
|
|
filename: "equipmentCenter.html",
|
2022-11-10 09:18:38 +08:00
|
|
|
title: "设备中台",
|
2022-06-08 14:51:11 +08:00
|
|
|
},
|
2022-11-10 09:18:38 +08:00
|
|
|
},
|
|
|
|
|
chainWebpack: (config) => {
|
|
|
|
|
const types = ["vue-modules", "vue", "normal-modules", "normal"];
|
|
|
|
|
types.forEach((type) =>
|
|
|
|
|
addStyleResource(config.module.rule("less").oneOf(type))
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
pluginOptions: {
|
|
|
|
|
"style-resources-loader": {
|
|
|
|
|
preProcessor: "stylus",
|
|
|
|
|
patterns: [],
|
2022-06-08 14:51:11 +08:00
|
|
|
},
|
2022-11-10 09:18:38 +08:00
|
|
|
},
|
|
|
|
|
productionSourceMap: false,
|
|
|
|
|
configureWebpack: {
|
|
|
|
|
optimization: {
|
|
|
|
|
minimizer: [
|
|
|
|
|
new TerserPlugin({
|
|
|
|
|
terserOptions: {
|
|
|
|
|
ecma: undefined,
|
|
|
|
|
warnings: false,
|
|
|
|
|
parse: {},
|
|
|
|
|
compress: {
|
|
|
|
|
drop_console: true,
|
|
|
|
|
drop_debugger: false,
|
|
|
|
|
pure_funcs: ["console.log"], // 移除console
|
2022-06-08 14:51:11 +08:00
|
|
|
},
|
2022-11-10 09:18:38 +08:00
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
],
|
2022-06-08 14:51:11 +08:00
|
|
|
},
|
2022-11-10 09:18:38 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// configureWebpack: (config) => {
|
|
|
|
|
// Object.assign(config, {
|
|
|
|
|
// // 开发生产共同配置
|
|
|
|
|
// resolve: {
|
|
|
|
|
// alias: {
|
|
|
|
|
// '@': path.resolve(__dirname, './src'),
|
|
|
|
|
// '@c': path.resolve(__dirname, './src/components'),
|
|
|
|
|
// '@p': path.resolve(__dirname, './src/assets/j')
|
|
|
|
|
// } // 别名配置
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
};
|