Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows the Vite development server to run inside the
laravel.test
container viasail 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).