//我們使用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" }, }