昨天一個Vue項目打包后,今天測試,發現無論localhost還是服務器上都運行不了,報錯如下:
Failed to load resource: the server responded with a status of 400 (Bad Request)
網上搜索一圈,牛頭不對馬嘴的居多,向一前輩請教后,問題迎刃而解,現將方法分享如下:
其實超級簡單!超級簡單!超級簡單!重要是事情說三遍,只需----------》
找到node_modules/@vue/cli-service/lib/options.js文件,將下圖中81行的publicPath:'./'和83行的baseUrl:'./' 路徑前面的(.)去掉即可!!
是不是so easy ??