Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent console warning when Vite pings HMR #98

Merged
merged 1 commit into from
Jul 22, 2022

Conversation

jessarcher
Copy link
Member

@jessarcher jessarcher commented Jul 21, 2022

This PR removes the console warning when the dev server is accessed directly.

This addresses an issue with Vite 3 where it now pings the root URL when it loses connection with the HMR server, showing this misleading error message.

It's tricky to distinguish between a user visit and a ping because they're both made by the browser. While we could do it, potentially with some upstream help, I don't know that it's worth the effort as the index page we serve should hopefully be enough to guide users towards accessing a Laravel dev server.

Fixes #96

Copy link
Member

@timacdonald timacdonald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine. I did play with having the Vite client send a VITE-PING header so we could detect the difference, but I think we could look at it again and restore this in the future if it continues to be a problem even with the HTML warning page.

@jessarcher jessarcher merged commit 53f8f4e into main Jul 22, 2022
@jessarcher jessarcher deleted the remove-direct-access-console-warning branch July 22, 2022 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error while using Inertia Vue: The Vite server should not be accessed directly.
2 participants