const path = require("path"); function resolve(dir) { return path.join(__dirname, dir); } const pubPath = process.env.NODE_ENV === "development" ? "./" : "http://oyweb.ouj.com/other/shop-popularize/"; module.exports = { publicPath: pubPath, chainWebpack: config => { // 设置别名 config.resolve.alias.set("@", resolve("src")); }, outputDir:"../../build/other/shop-popularize", devServer: { // 疯狂丢cookie 还是代理了没啥事 proxy: { //配置代理 "/api": { target: "http://pgame.ouj.com/hdCenter", //请求测试地址 // target: "http://pageapi.webdev2.duowan.com/hdCenter", // 线上地址 ws: true, //是否代理 changeOrigin: true, //是否跨域 pathRewrite: { "^/api": "" } } }, disableHostCheck: true, // 内网穿透,设置了才能访问 watchOptions: { ignored: /node_modules/, aggregateTimeout: 300, //文件变动后多久发起构建,越大越好 poll: 1000 //每秒询问次数,越小越好 } } };