Vue打包後built files are meant to be served over an HTTPserver.Opening index.html空白頁和css圖片不顯示

1、使用命令npm run build打包vue項目之後提示 :
“Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won’t work.”,
並且在本地打開index.html是空白頁,是因爲打包的時候配置文件config的index.js的build配置是默認assetsPublicPath爲“/”根路徑,把assetsPublicPath修改爲“./”同一個路徑重新打包即可。
vue打包空白頁解決

2、解決了頁面空白問題之後會出現css樣式的圖片不顯示問題,那麼在build的目錄下的utils.js文件添加publicPath: '…/…/'重新打包即可。
css圖片不顯示問題

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