83 lines
2.3 KiB
JavaScript
83 lines
2.3 KiB
JavaScript
const webpack = require("webpack");
|
|
const port = 7774;
|
|
var path = require("path"); //必须引入path 否则报错
|
|
module.exports = {
|
|
publicPath: "./",
|
|
devServer: {
|
|
port,
|
|
// 允许被主应用跨域fetch请求到
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
},
|
|
proxy: {
|
|
"/TestApi": {
|
|
//本地服务接口地址
|
|
target: "http://127.0.0.1:8000",
|
|
ws: true,
|
|
https: true,
|
|
pathRewrite: {
|
|
"^/TestApi": "",
|
|
},
|
|
},
|
|
"/json": {
|
|
//本地服务接口地址
|
|
// target: 'http://link.ser99.vip:8080/zhongkai',
|
|
target: 'http://65.73.11.246:7774',
|
|
// target: 'http://172.16.1.111:8000',
|
|
// target: "http://172.16.1.148:8084",
|
|
// target: 'http://172.16.1.162:8233',
|
|
// target: 'http://192.168.13.138:8233',
|
|
// target: 'http://172.16.1.113:8012',
|
|
ws: true,
|
|
https: true,
|
|
pathRewrite: {
|
|
"^/json": "/json",
|
|
},
|
|
},
|
|
"/xjIotApi": {
|
|
//集采
|
|
// target: 'http://65.73.11.246:8083',
|
|
// target: 'http://172.16.1.155:8080',
|
|
target: "http://172.16.1.148:8083",
|
|
ws: true,
|
|
https: true,
|
|
pathRewrite: {
|
|
"^/xjIotApi": "/xjIotApi",
|
|
},
|
|
},
|
|
"/iotApi": {
|
|
//平台
|
|
// target: 'http://65.73.11.246:8090',
|
|
// target: 'http://172.16.1.155:8080',
|
|
target: "http://172.16.1.148:8080",
|
|
ws: true,
|
|
https: true,
|
|
pathRewrite: {
|
|
"^/iotApi": "/iotApi",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
chainWebpack: (config) => {
|
|
//设置图片不转base64格式 图片少 且对图片质量要求高
|
|
const imagesRule = config.module.rule("images");
|
|
imagesRule.uses.clear(); //清除原本的images loader配置
|
|
imagesRule
|
|
.test(/\.(jpg|gif|png|svg)$/)
|
|
.exclude.add(path.join(__dirname, "../node_modules")) //去除node_modules里的图片转base64配置
|
|
.end()
|
|
.use("url-loader")
|
|
.loader("url-loader")
|
|
.options({ name: "img/[name].[hash:8].[ext]", limit: 1 });
|
|
},
|
|
configureWebpack: {
|
|
plugins: [
|
|
new webpack.ProvidePlugin({
|
|
$: "jquery",
|
|
jQuery: "jquery",
|
|
"windows.jQuery": "jquery",
|
|
}),
|
|
],
|
|
},
|
|
};
|