When using react-loadable
, you aren't easily alerted by errors thrown in those async components, like a bad import.
I'd like to be able to disable react-loadable in dev environment (bypass it, and load everything synchronously) and enable it in production, but I don't know how to override react-loadable to make this work:
import Loadable from 'react-loadable';
import LoadingComponent from './Loading';
// My reused loadable component everywhere
// In production
export default options =>
Loadable({
loading: LoadingComponent,
delay: 200,
...options,
});
// Ideally a dev version that skips loadable
// In development, without any async import
export default options => options.loader(); // Does not work
Is there a way to do this?
react-loadable
or can you use suspense? – Taurine