-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Clear and concise description of the problem
It is technically possible to get Vite apps to work offline in dev mode. Just configure your service worker so that it caches every request to the Vite dev server except for __vite_ping requests. The latter is important to prevent @vite/client from falling into a recurring page reload: when the network connection is lost, @vite/client pings the dev server every 1 sec and reloads the page as soon as the server responds with the HTTP 200 status.
Now that you managed to run your app offline, the only problem is, you see a huge number of failed ping requests on the DevTools Network tab and in the browser console. They are quite distracting when you are testing something and are essentially unnecessary work.
Suggested solution
It would be better if @vite/client waited for navigator.onLine to become true and only then started polling the dev server for availability. This way it will save unnecessary ping requests and avoid unnecessary noise in DevTools.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.