const path = require('path') function resolve(dir) { return path.join(__dirname, dir) } module.exports = { parallel: false, configureWebpack: { externals: { vue: 'Vue', vuex: 'Vuex', 'vue-router': 'VueRouter', axios: 'axios', } }, outputDir:'../../public/building/', assetsDir:'', indexPath:'../../public/building.html', productionSourceMap: false, // 关键语句 publicPath: process.env.NODE_ENV === 'production' ? './building/' : '', css: { // 是否使用css分离插件 ExtractTextPlugin // extract: true, // 开启 CSS source maps? sourceMap: false, // css预设器配置项 loaderOptions: { postcss: { plugins: [ require('postcss-px2rem-exclude')({ //配置项,详见官方文档 remUnit: 75, // 换算的基数 exclude: /node_modules/ }) ] }, less: { javascriptEnabled: true, globalVars: { primary: '#fff' } } }, requireModuleExtension: true }, devServer: { proxy: { "/client": { // saastest.zhuangqixiaoguan.com // h5.zqxg.cc target: "https://h5.zqxg.cc/client", //设置你调用的接口域名和端口号 别忘了加http、https changeOrigin: true, //是否跨域 // secure: true, // 允许https请求 ws: true, pathRewrite: { "^/client": "" //这里理解成用‘/api’代替target里面的地址 } }, "/api": { target: "https://h5.zqxg.cc/api", //设置你调用的接口域名和端口号 别忘了加http、https changeOrigin: true, //是否跨域 // secure: true, // 允许https请求 ws: true, pathRewrite: { "^/api": "" //这里理解成用‘/api’代替target里面的地址 } }, "/mobile": { target: "https://h5.zqxg.cc/mobile", //设置你调用的接口域名和端口号 别忘了加http、https changeOrigin: true, //是否跨域 secure: true, // 允许https请求 ws: true, pathRewrite: { "^/mobile": "" //这里理解成用‘/api’代替target里面的地址 } }, "/index": { target: "https://h5.zqxg.cc/index", //设置你调用的接口域名和端口号 别忘了加http、https changeOrigin: true, //是否跨域 // secure: true, // 允许https请求 ws: true, pathRewrite: { "^/index": "" //这里理解成用‘/api’代替target里面的地址 } }, } } }