// const targetUrl = 'http://192.168.1.220/'
const targetUrl = 'http://192.168.1.218/'
// const targetUrl = 'https://www.xyzshops.cn/'
// 椰子临时线上
// const targetUrl = 'http://121.89.196.45/'
module.exports = {
publicPath:'./',
productionSourceMap: false,
pages: {
index: {
// page 的入口
entry: 'src/main.js',
// 模板来源
template: 'public/index.html',
// 在 dist/index.html 的输出
filename: 'index.html',
// 当使用 title 选项时,template 中的 title 标签需要是
<%= htmlWebpackPlugin.options.title %>
title: '椰子充值后台管理系统程序',
},
},
devServer: {
open: true,
// host: 'localhost',
host: '192.168.1.160',
port: 3333,
https: false,
//以上的ip和端口是我们本机的;下面为需要跨域的
proxy: {//配置跨域
'/api': {
target: targetUrl,//这里后台的地址模拟的;应该填写你们真实的后台接口
ws: true,
changOrigin: true,//允许跨域
pathRewrite: {
'^/api': ''//请求的时候使用这个api就可以
}
},
}
},
chainWebpack: config => {
config.module
.rule("css")
.test(/\.css$/)
.oneOf("vue")
.resourceQuery(/\?vue/)
.use("px2rem")
.loader("px2rem-loader")
.options({
// remUnit: 192
remUnit: 210
});
},
// 打包去掉console.log
// configureWebpack: (config) => {
// if (process.env.NODE_ENV === 'production') {
// config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
// }
// }
}