vue npm run build打包后index.html空白

Vue打包npm run build 打包后空白怎么解决?

问题一:路径报错并且页面空白

在打包时提示


image.png

需要在vue.config.js中添加代码 publicPath: './',


image.png

问题二:没报错页面空白 router-view中的内容显示不出来。路由history模式。

HTML5 History模式的原因
解决:// mode: 'history',//将这个模式关闭就好


image.png

你可能感兴趣的:(vue npm run build打包后index.html空白)