the project is deployed on Nginx. Because the / change directory has already given other permissions, it is said that the project is directly placed under / dist, so the assetsPublicPath changes to the relative path
when build.build: {
// Template for index.html
index: path.resolve(__dirname, "../dist/index.html"),
// Paths
assetsRoot: path.resolve(__dirname, "../dist"),
assetsSubDirectory: "static",
assetsPublicPath: "./",
When build, the API also requests the root path directly. It"s no problem
const service = axios.create({
//baseURL: process.env.ENV_CONFIG=="dev"?"/api":"", // apibase_url
baseURL: process.env.ENV_CONFIG=="dev"?"/api":process.env.BASE_API,
timeout: 5000, //
headers:{
"isWeb": 1,
"Content-Type": "application/json;charset=utf-8"
}
})
but according to the official statement, as Nginx said, the configuration https://blog.csdn.net/u011025., refresh or error 404, then I searched and said that assetsPublicPath may be configured as an absolute path, but if configured as an absolute path, static resources cannot be found
.
ask for answers