美文网首页
vue npm run build打包后index.html空白

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

作者: 艳晓 | 来源:发表于2019-10-17 17:20 被阅读0次

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空白

      本文链接:https://www.haomeiwen.com/subject/cmjvmctx.html