本地404
vue.config.js设置publicPath、historyApiFallback
module.exports = {
publicPath: '/',
devServer: {
historyApiFallback: {
index: '/' //与Output的publicPath
},
}
}
配置后,本地页面刷新ok
线上404
在nginx.conf中添加参数配置:
location / { try_files $uri $uri/ /index.html$args; }