You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
I'm trying to understand how to resolve the following scenario:
The user is online and loads my web app.
Later, the user goes offline and navigates somewhere in the app which triggers a dynamically imported module resolved via an import map.
Because I'm offline, the module loading will result in an error of Failed to fetch dynamically imported module. The app notifies the user that they are offline.
Now the user reconnects and becomes online.
We retry the original module fetch, which fails because the browser never retries the original request.
If I wasn't using import maps, I could force a retry by adding a query parameter to the URL I'm importing. With module maps, is there any way to retry a module import that has previously failed?
Note: in my scenario above, I could solve the problem by building a wrapper around the native import() that keeps track of whether the user is online/offline and prevent a module request from going out unless they are online. But that doesn't resolve all of the scenarios where a module resolution might fail, and the app may want to retry.