//我们使用hash模式时,打包线上,容易出现页面空白的情况,所以如下配置
"h5" : { "devServer" : { "publicPath":"./" "https" : false, "port" : 3000, "disableHostCheck" : true, "proxy" : { "/api" : { "target" : "https://m.shop.com", "ws" : true, "changOrigin" : true, "pathRewrite" : { "^/api" : "" } } } }, }
//但我们使用历史模式(history)模式的时候,不能用hash模式的配置
"h5" : { "devServer" : { // "publicPath":"./" //注意隐藏这行 "https" : false, "port" : 3000, "disableHostCheck" : true, "proxy" : { "/api" : { "target" : "m.shop.com", // "target":"http://localhost:8080/hht_mall/", "ws" : true, "changOrigin" : true, "pathRewrite" : { "^/api" : "" } } } }, "router" : { "base" : "mall/website/", //填写你的线上地址(如http://m.shop.com/mall/webiste/,线上根目录是http://m.shop.com,取得是根目录后的mall/website, 注意本地开发时需要隐藏这行 "mode" : "history" }, }
来源:https://www.cnblogs.com/uimeigui/p/12597378.html