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

Suggestion: Add support for Laravel Sail + WSL2 #2

Open
zunnur-trinovik opened this issue Oct 26, 2022 · 3 comments
Open

Suggestion: Add support for Laravel Sail + WSL2 #2

zunnur-trinovik opened this issue Oct 26, 2022 · 3 comments

Comments

@zunnur-trinovik
Copy link

Hi, Unless the following config is added, hot reload will not work in WSL2. Alternatively, Put as comment in vite.config.js so the user can uncomment if necessary.

vite.config.js:

server: {
    hmr: {
          host: 'localhost',
    },
}

docker-compose.yml

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel.test:
        build:
            context: ./vendor/laravel/sail/runtimes/8.1
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.1/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-80}:80'
            - '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
networks:
    sail:
        driver: bridge
@notflip
Copy link

notflip commented Nov 6, 2022

@zunnur-trinovik Question, I included the server block in vite.config.js, should I just run php artisan serve alongside for it to work? I updated some code in my view, vite said "page reload" correctly, but my http://localhost page did not update.

@zunnur-trinovik
Copy link
Author

@zunnur-trinovik Question, I included the server block in vite.config.js, should I just run php artisan serve alongside for it to work? I updated some code in my view, vite said "page reload" correctly, but my http://localhost page did not update.

You need to run npm run dev.

@notflip
Copy link

notflip commented Nov 7, 2022

@zunnur-trinovik It's working now, I'm using Brave browser and it was blocking the JS required for auto-reload.

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

No branches or pull requests

2 participants