I'm running a Server rendered react app and having an issue with Loadable.preloadReady()
resolving instantly, and not preloading the available modules.
My SSR
is perfectly fine with preloadAll()
, it understands which components are required, loads their scripts and creates the SSR HTML
fine.
When it switches to index.js
with the same module array it doesn't work
EDIT: I can see that the READY_INITIALIZERS
array is empty when it runs hence why nothing is loading:
Loadable.preloadReady = function () {
return new Promise(function (resolve, reject) {
// We always will resolve, errors should be handled within loading UIs.
flushInitializers(READY_INITIALIZERS).then(resolve, resolve);
});
};
I'm going to have a go at setting the webpack opt, the docs say this isn't necessary but it looks like the only reason it wouldn't populate the array:
ALL_INITIALIZERS.push(init);
if (typeof opts.webpack === "function") {
console.log("is a function");
READY_INITIALIZERS.push(function () {
if (isWebpackReady(opts.webpack)) {
console.log("webpack is ready");
return init();
}
});
}