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

[1.x] Publish the Vite port #433

Merged
merged 2 commits into from
Jun 21, 2022
Merged

[1.x] Publish the Vite port #433

merged 2 commits into from
Jun 21, 2022

Conversation

jessarcher
Copy link
Member

This PR allows the Vite development server to run inside the laravel.test container via sail npm run dev.

The Laravel Vite Plugin is configured to automatically detect when inside Sail. It will configure Vite to listen on the container's public address to allow the port publishing to work correctly.

Note that the configuration in this PR will mean that Vite cannot run on this port outside of the container while the container is running because Docker will have taken the port. This is not a problem because Vite will automatically find an available port, and our plugin will pass the correct port to Laravel via the public/hot file.

Also, note that the VITE_PORT env variable is used on both sides of the port publishing map because it will also configure our Vite plugin to listen on that port, unlike the other env variables.

Finally, note that the default port in this PR is the Vite 3 default port. It will work with Vite 2 because our plugin will default to this port when running inside Sail (see above link).

@jessarcher jessarcher marked this pull request as ready for review June 17, 2022 07:04
@taylorotwell taylorotwell marked this pull request as draft June 18, 2022 05:45
@taylorotwell taylorotwell marked this pull request as ready for review June 21, 2022 19:51
@taylorotwell taylorotwell merged commit b69e7bc into 1.x Jun 21, 2022
@taylorotwell taylorotwell deleted the vite branch June 21, 2022 19:51
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.

2 participants