The initial loading of dashes is very slow, due to the loading of third-party libraries

hello everyone, I have been using dash plotly for a long time and every application that I created on the first visit it loaded very slowly, regardless of the size of the application, even if it was a single-page or multi-page application, and I noticed that when we visit the application for the first time, third-party library scripts are loaded and they are usually more than 1mb and I think that this process slows down the initial download

in the next photo you can see the process of loading the script of third-party libraries

and with a slow internet connection, you can wait indefinitely. I would appreciate any advice on how to fix this situation.

Dash does have the ability to load some of its assets from a CDN. This is disabled by default though. You could try enabling this by passing in serve_locally=False when creating a new Dash instance.

Hopefully that helps, but your mileage may very. For popular libraries like lodash and rambda, they’d likely already be cached on the client, but Dash libs are little more niche, so this may not happen so much. The other consideration is that the CDN may often offer faster download speeds than compared with where the Dash app is being hosted, possibly speeding up those wait times.

It turns out I can save those library scripts that are loaded locally? And then at the first entrance will not be loaded anymore? Did I understand correctly?