Repository URL to install this package:
|
Version:
1.0.0 ▾
|
| dist |
| src |
| CHANGELOG.md |
| README.md |
| package.json |
| tsconfig.json |
import('path') in a loadable function (because as soon as import() is called, the file starts loading)import('path') is a promiseloadable into a () => class LoadableComponentLoadableComponent will be included in the main chunk, but only starts loading the loadable function during componentWillMountconst loadable = (loadComponent) => class extends React.PureComponent { state = { Component: undefined } async componentWillMount() { this.setState({ Component: await loadComponent() }) } render() { return <scoped.Component {...this.props} /> } } export const Eh = loadable(() => import(/* webpackChunkName: "Eh.page" */ '../../views/pages/Eh') )