我在本地有一個(gè) Vue,主要/index.html是 webroot,但是當(dāng)我部署時(shí),我希望子文件夾/stats成為根目錄(并且我的所有路由仍然有效)。我可以在不手動(dòng)更改路由器/index.js 的情況下執(zhí)行此操作嗎?vue.config.js// this doesn't seem to workmodule.exports = { publicPath: process.env.NODE_ENV === "production" ? "/stats/" : "/",};路由器.jsconst routes = [ { path: "/", name: "HomeView", component: HomeView, }, { path: "/grid", name: "GridView", component: GridView, }, ...]
Vue CLI 構(gòu)建 - 使用“/”作為根在本地開(kāi)發(fā),但部署到“/子文件夾/”作為根?
慕尼黑8549860
2022-11-03 09:55:25