错误:加载块0失败

时间:2018-02-23 03:10:53

标签: laravel-5 vuejs2 laravel-routing vue-router

我正在使用Buefy和Laravel并拥有以下路线

Laravel

Route::get('/{vue?}', function () {
    return view('app');
})->where('vue', '[\/\w\.-]*')->name('app');

然后是VueJS

...routes = [
  {
    path: '/', component: MainLayout,
    children: [
      {
        path: '/home',
        component: Home,
        name: 'home'
      },
      {
        path: '/login',
        name: 'login',
        component: Login,
        meta: { auth: false }
      },
      {
        path: '/collect/:id',
        name: 'collect',
        component: Collect,
        meta: { auth: false } // set to true
      }
    ]
  },
    { path: '*', component: NotFoundPage }
]

但是当我输入网址 / collect / 123 时,我得到了

  

无法解析异步组件默认值:错误:加载块0失败。

     

路线导航期间未捕获的错误:

     

未捕获的SyntaxError:意外的令牌<       manifest.js:144错误:加载块0失败。

    at HTMLScriptElement.onScriptComplete (manifest.js:99)
__webpack_require__.oe @ manifest.js:144
Promise.catch (async)
MainLayout @ routes.js?952c:11
(anonymous) @ vue-router.esm.js?880d:1965
(anonymous) @ vue-router.esm.js?880d:1992
(anonymous) @ vue-router.esm.js?880d:1992
flatMapComponents @ vue-router.esm.js?880d:1991
(anonymous) @ vue-router.esm.js?880d:1930
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
step @ vue-router.esm.js?880d:1622
step @ vue-router.esm.js?880d:1622
(anonymous) @ vue-router.esm.js?880d:1619
(anonymous) @ vue-router.esm.js?880d:1756
(anonymous) @ routes.js?952c:83
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
runQueue @ vue-router.esm.js?880d:1626
confirmTransition @ vue-router.esm.js?880d:1764
transitionTo @ vue-router.esm.js?880d:1666
init @ vue-router.esm.js?880d:2335
beforeCreate @ vue-router.esm.js?880d:495
callHook @ vue.common.js?e881:2558
Vue._init @ vue.common.js?e881:3998
Vue$3 @ vue.common.js?e881:4097
(anonymous) @ app.js?8b67:14
(anonymous) @ app.js:1429
__webpack_require__ @ manifest.js:53
(anonymous) @ app.js:2707
__webpack_require__ @ manifest.js:53
webpackJsonpCallback @ manifest.js:24
(anonymous) @ app.js:1
manifest.js:144 Error: Loading chunk 0 failed.
    at HTMLScriptElement.onScriptComplete (manifest.js:99)
__webpack_require__.oe @ manifest.js:144
Promise.catch (async)
Collect @ routes.js?952c:18
(anonymous) @ vue-router.esm.js?880d:1965
(anonymous) @ vue-router.esm.js?880d:1992
(anonymous) @ vue-router.esm.js?880d:1992
flatMapComponents @ vue-router.esm.js?880d:1991
(anonymous) @ vue-router.esm.js?880d:1930
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
step @ vue-router.esm.js?880d:1622
step @ vue-router.esm.js?880d:1622
(anonymous) @ vue-router.esm.js?880d:1619
(anonymous) @ vue-router.esm.js?880d:1756
(anonymous) @ routes.js?952c:83
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
runQueue @ vue-router.esm.js?880d:1626
confirmTransition @ vue-router.esm.js?880d:1764
transitionTo @ vue-router.esm.js?880d:1666
init @ vue-router.esm.js?880d:2335
beforeCreate @ vue-router.esm.js?880d:495
callHook @ vue.common.js?e881:2558
Vue._init @ vue.common.js?e881:3998
Vue$3 @ vue.common.js?e881:4097
(anonymous) @ app.js?8b67:14
(anonymous) @ app.js:1429
__webpack_require__ @ manifest.js:53
(anonymous) @ app.js:2707
__webpack_require__ @ manifest.js:53
webpackJsonpCallback @ manifest.js:24
(anonymous) @ app.js:1
vue-router.esm.js?880d:16 [vue-router] Failed to resolve async component default: Error: Loading chunk 0 failed.
warn @ vue-router.esm.js?880d:16
(anonymous) @ vue-router.esm.js?880d:1954
(anonymous) @ vue-router.esm.js?880d:2013
Promise.then (async)
(anonymous) @ vue-router.esm.js?880d:1971
(anonymous) @ vue-router.esm.js?880d:1992
(anonymous) @ vue-router.esm.js?880d:1992
flatMapComponents @ vue-router.esm.js?880d:1991
(anonymous) @ vue-router.esm.js?880d:1930
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
step @ vue-router.esm.js?880d:1622
step @ vue-router.esm.js?880d:1622
(anonymous) @ vue-router.esm.js?880d:1619
(anonymous) @ vue-router.esm.js?880d:1756
(anonymous) @ routes.js?952c:83
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
runQueue @ vue-router.esm.js?880d:1626
confirmTransition @ vue-router.esm.js?880d:1764
transitionTo @ vue-router.esm.js?880d:1666
init @ vue-router.esm.js?880d:2335
beforeCreate @ vue-router.esm.js?880d:495
callHook @ vue.common.js?e881:2558
Vue._init @ vue.common.js?e881:3998
Vue$3 @ vue.common.js?e881:4097
(anonymous) @ app.js?8b67:14
(anonymous) @ app.js:1429
__webpack_require__ @ manifest.js:53
(anonymous) @ app.js:2707
__webpack_require__ @ manifest.js:53
webpackJsonpCallback @ manifest.js:24
(anonymous) @ app.js:1
vue-router.esm.js?880d:16 [vue-router] uncaught error during route navigation:
warn @ vue-router.esm.js?880d:16
abort @ vue-router.esm.js?880d:1696
(anonymous) @ vue-router.esm.js?880d:1739
(anonymous) @ vue-router.esm.js?880d:1959
(anonymous) @ vue-router.esm.js?880d:2013
Promise.then (async)
(anonymous) @ vue-router.esm.js?880d:1971
(anonymous) @ vue-router.esm.js?880d:1992
(anonymous) @ vue-router.esm.js?880d:1992
flatMapComponents @ vue-router.esm.js?880d:1991
(anonymous) @ vue-router.esm.js?880d:1930
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
step @ vue-router.esm.js?880d:1622
step @ vue-router.esm.js?880d:1622
(anonymous) @ vue-router.esm.js?880d:1619
(anonymous) @ vue-router.esm.js?880d:1756
(anonymous) @ routes.js?952c:83
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
runQueue @ vue-router.esm.js?880d:1626
confirmTransition @ vue-router.esm.js?880d:1764
transitionTo @ vue-router.esm.js?880d:1666
init @ vue-router.esm.js?880d:2335
beforeCreate @ vue-router.esm.js?880d:495
callHook @ vue.common.js?e881:2558
Vue._init @ vue.common.js?e881:3998
Vue$3 @ vue.common.js?e881:4097
(anonymous) @ app.js?8b67:14
(anonymous) @ app.js:1429
__webpack_require__ @ manifest.js:53
(anonymous) @ app.js:2707
__webpack_require__ @ manifest.js:53
webpackJsonpCallback @ manifest.js:24
(anonymous) @ app.js:1
vue-router.esm.js?880d:1697 Error: Loading chunk 0 failed.
    at HTMLScriptElement.onScriptComplete (manifest.js:99)
abort @ vue-router.esm.js?880d:1697
(anonymous) @ vue-router.esm.js?880d:1739
(anonymous) @ vue-router.esm.js?880d:1959
(anonymous) @ vue-router.esm.js?880d:2013
Promise.then (async)
(anonymous) @ vue-router.esm.js?880d:1971
(anonymous) @ vue-router.esm.js?880d:1992
(anonymous) @ vue-router.esm.js?880d:1992
flatMapComponents @ vue-router.esm.js?880d:1991
(anonymous) @ vue-router.esm.js?880d:1930
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
step @ vue-router.esm.js?880d:1622
step @ vue-router.esm.js?880d:1622
(anonymous) @ vue-router.esm.js?880d:1619
(anonymous) @ vue-router.esm.js?880d:1756
(anonymous) @ routes.js?952c:83
iterator @ vue-router.esm.js?880d:1735
step @ vue-router.esm.js?880d:1618
runQueue @ vue-router.esm.js?880d:1626
confirmTransition @ vue-router.esm.js?880d:1764
transitionTo @ vue-router.esm.js?880d:1666
init @ vue-router.esm.js?880d:2335
beforeCreate @ vue-router.esm.js?880d:495
callHook @ vue.common.js?e881:2558
Vue._init @ vue.common.js?e881:3998
Vue$3 @ vue.common.js?e881:4097
(anonymous) @ app.js?8b67:14
(anonymous) @ app.js:1429
__webpack_require__ @ manifest.js:53
(anonymous) @ app.js:2707
__webpack_require__ @ manifest.js:53
webpackJsonpCallback @ manifest.js:24
(anonymous) @ app.js:1
vue-router.esm.js?880d:16 [vue-router] Failed to resolve async component default: Error: Loading chunk 0 failed.

我不确定错误是什么以及它是否是VueJS或Laravel错误。这是什么意思?

编辑:

将路线更改为

{
            path: '/collect',
            name: 'collect',
            component: Collect,
            meta: { auth: false } // set to true
          }

解决了错误但我需要将其设置为传递参数的动态路由....为什么它会给我这个错误?

0 个答案:

没有答案