0👍
✅
There’s two things to do here…
-
Set your
publicPath
to the static site base URL// vue.config.js module.exports = { publicPath: process.env.NODE_ENV === "production" ? "https://static.my-site.com/" : "/" }
-
Set your router’s
base
to the base path of your appimport Vue from "vue" import VueRouter from "vue-router" Vue.use(VueRouter) const router = new VueRouter({ base: process.env.NODE_ENV === "production" ? "/my-path/" : "/", routes: [...] })
-1👍
You could use the absolute locations in the import statements
Source:stackexchange.com