[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