I am interested in breaking my source code into two pieces that are loaded asynchronously by the application using the async / defer attributes. One is for selling libraries that rarely change and are large, so they can benefit from caching for a longer time, and the other with the basic code needed to load the start page. This will be a smaller piece, which is likely to change every week, as we often use changes in production.
But we are interested in displaying the correct page "loading ..." until all JS resources are loaded. If the JS application completes the download to the provider version (when the provider is not cached, this is likely to happen), it should wait for the provider to load.
I was not able to figure out how to do this with webpack. There are examples of loading the provider block synchronously so that the application code always loads after the provider, but this means that the application will not display the correct page "loading ..." due to blocking JS script. I could add a script to the end of the body, but this is not optimal, because it will increase the delay for starting script loading compared to adding async script tags to the beginning of the document.
The code break documentation has an example of how to create a provider and a JS application, but it only works if the provider is loaded before the JS application. Is there a way I can instruct the application package to wait for the provider to load before launch?
source share