Using Vite With Laravel Herd

Published Nov 05 2024

Not sure if I was the only one that struggled to find an answer to this, but I'm posting it here for anyone who might also be unfamiliar with vite and didn't think to do this either. All you have to do is set the server.host in your vite.config.js:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js'
            ],
            refresh: true,
        }),
    ],
    server: {
        host: "[your site URL]"
    }

});