Vue打包後出錯:Tip: built files are meant to be served over an HTTP server. Opening index.html over file

1、使用命令npm run build打包vue項目之後提示 :
Tip: built files are meant to be served over an HTTP server.
Opening index.html over file
打包App的項目使用的是Cordova命令建立IOS項目,把npm run build的dist文件放到www文件,
運行項目,打開app時index.html是空白頁。
解決辦法:config的index.js的build配置是默認assetsPublicPath爲“/”根路徑,把assetsPublicPath修 改爲“./”同一個路徑重新打包即可。
在這裏插入圖片描述
2.不會出現空白頁後,圖片顯示不出來。
解決辦法:在build目錄下的untils.js文件中
ExtractTextPlugin方法中添加publicPath:’…/…/'就可以了。

然後重新打包,問題解決。在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章