Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Changes:
opts.LoadingComponent
→opts.loading
opts.resolveModule
withopts.render
for more controlopts.timeout
to go along withopts.delay
opts.delay
can be disabled by setting it tofalse
ornull
opts.serverSideRequirePath
(useimport-inspector
)opts.webpackRequireWeakId
(useimport-inspector
)Loadable.flushServerSideRequirePaths
(useimport-inspector
)Loadable.flushwebpackRequireWeakIds
(useimport-inspector
)import-inspector
babel-plugin-import-inspector
Loadable.Map
for loading multiple resources in parallelopts.render
This replaces
opts.resolveModule
to give more control over the actual rendering of the component.opts.timeout
Vue added this, I liked it so I stole it.
import-inspector
Rather than having a custom API tied to React Loadable for dealing with making
import()
compatible with synchronous workflows like server-side rendering and first render using Webpack, I've integrated React Loadable with a new library calledimport-inspector
which looks like this:You can automate all of this using:
babel-plugin-import-inspector
Since integrating with
import-inspector
there's little reason to support a half-baked half-working Babel plugin specific to React Loadable.Instead, babel-plugin-import-inspector can automatically add everything you need:
Install
.babelrc:
Input:
Output:
flushServerSideRequirePaths
andflushwebpackRequireWeakIds
This functionality is no longer necessary when using
import-inspector
.Instead you can do this:
Loadable.Map
If you want to load multiple resources in parallel and stitch them together in the
render()
method you can now do that withLoadable.Map
.