diff --git a/v2/lib/core/clientEntry.js b/v2/lib/core/clientEntry.js index 001eaea047..8e32531fde 100644 --- a/v2/lib/core/clientEntry.js +++ b/v2/lib/core/clientEntry.js @@ -6,15 +6,16 @@ */ import React from 'react'; -import Loadable from 'react-loadable'; import {BrowserRouter} from 'react-router-dom'; import ReactDOM from 'react-dom'; import App from './App'; +import preload from './preload'; +import routes from '@generated/routes'; // eslint-disable-line // Client side render (e.g: running in browser) to become single-page application (SPA) -if (typeof document !== 'undefined') { - Loadable.preloadReady().then(() => { +if (typeof window !== 'undefined' && typeof document !== 'undefined') { + preload(routes, window.location.pathname).then(() => { ReactDOM.render(