[vue-router] Failed to resolve async component default: Error: Loading chunk 0 failed.


在整合laravel5.4 和vue2.1的時候遇到一個奇怪的問題

Uncaught SyntaxError: Unexpected token <
Error: Loading chunk 0 failed.
at HTMLScriptElement.onScriptComplete (app.js:99)
[vue-router] Failed to resolve async component default: Error: Loading chunk 0 failed.
Error: Loading chunk 0 failed.
at HTMLScriptElement.onScriptComplete (app.js:99)

兩個組件 一個能加載  一個報錯,可能原因是不支持延遲加載Vue組件

解決方法是 laravel 5.4已經支持webpack 

在 webpack.mix.js 中加上

output: {
publicPath: '/'
}
這個配置就可以了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM