2022-06-08 14:51:11 +08:00
|
|
|
|
|
|
|
|
const path = require('path')
|
|
|
|
|
// 代码压缩
|
|
|
|
|
const TerserPlugin = require("terser-webpack-plugin");
|
|
|
|
|
function addStyleResource (rule) {
|
|
|
|
|
rule.use('style-resource')
|
|
|
|
|
.loader('style-resources-loader')
|
|
|
|
|
.options({
|
|
|
|
|
patterns: [
|
|
|
|
|
path.resolve(__dirname, 'src/assets/style/var.less'),//全局引入的less文件
|
|
|
|
|
path.resolve(__dirname, 'src/assets/style/longguang.less'),//全局引入的less文件--龙光地产
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
module.exports = {
|
|
|
|
|
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
2022-07-22 15:53:09 +08:00
|
|
|
devServer:{
|
|
|
|
|
proxy:{
|
|
|
|
|
'/china' : {
|
|
|
|
|
target: "http://122.112.239.62:9000",
|
|
|
|
|
changeOrigin:true,
|
|
|
|
|
pathRewrite:{
|
|
|
|
|
'^/china':"" //重写路径
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-06-08 14:51:11 +08:00
|
|
|
pages:{
|
|
|
|
|
index: {
|
|
|
|
|
entry: "./src/pages/index/index.js",
|
|
|
|
|
template: "./src/pages/index/index.html",
|
|
|
|
|
filename: "index.html",
|
|
|
|
|
title: "机械设备管理平台"
|
|
|
|
|
},
|
|
|
|
|
equipmentCenter: {
|
|
|
|
|
entry: "./src/pages/equipmentCenter/equipmentCenter.js",
|
|
|
|
|
template: "./src/pages/equipmentCenter/equipmentCenter.html",
|
|
|
|
|
filename: "equipmentCenter.html",
|
|
|
|
|
title: "设备中台"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// configureWebpack: (config) => {
|
|
|
|
|
// Object.assign(config, {
|
|
|
|
|
// // 开发生产共同配置
|
|
|
|
|
// resolve: {
|
|
|
|
|
// alias: {
|
|
|
|
|
// '@': path.resolve(__dirname, './src'),
|
|
|
|
|
// '@c': path.resolve(__dirname, './src/components'),
|
|
|
|
|
// '@p': path.resolve(__dirname, './src/assets/j')
|
|
|
|
|
// } // 别名配置
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|