反应可加载而不是预加载的组件

时间:2019-12-02 16:57:05

标签: javascript reactjs webpack server-side-rendering react-loadable

我正在使用react loadable进行代码拆分,并不断出现以下错误:

index.js?0a70:36 Uncaught (in promise) TypeError: Cannot read property 'then' of undefined
    at load (index.js?0a70:36)
    at init (index.js?0a70:121)
    at flushInitializers (index.js?0a70:310)
    at eval (index.js?0a70:322)
    at new Promise (<anonymous>)
    at Function.Loadable.preloadAll (index.js?0a70:321)
    at window.onload (app.js?ff8e:23)

我的应用程序文件如下所示:

const render = (Routes, client) => {
  window.onload = () => {
  Loadable.preloadAll().then(() => {
  ReactDOM.render(
    <Application Routes={Routes} client={client} />,
    document.getElementById('root')
  )
  })
  }
}

什么会导致此preloadAll不确定?我也尝试过preloadReady,但没有成功。

0 个答案:

没有答案