You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vite:watch writes an unreachable dev-server URL (http://[::]:5173) to the hot file on IPv6 hosts #1525
vite:watch unconditionally appends a bare --host flag to the Vite dev-server command. On an IPv6-enabled host (e.g. macOS), Vite binds to the unspecified address and the Laravel Vite plugin resolves the dev-server URL to [::], writing http://[::]:5173 into <package>/assets/dist/hot. The backend then emits asset/HMR URLs pointing at http://[::]:5173, which a browser cannot connect to — so the backend loads unstyled and HMR never engages.
Environment
Winter core develop, laravel-vite-plugin v1.3.0, Vite v6.4.3
Load any backend page → assets fail to connect (http://[::]:5173/@vite/client)
Root cause
modules/system/console/asset/vite/ViteWatch.php:
protectedfunctioncreateCommand(string$configPath): array
{
$command = parent::createCommand($configPath);
$key = array_search('build', $command);
unset($command[$key]);
$command[] = '--host'; // bare flag => bind all interfaces => hot file gets [::]returnarray_values($command);
}
Because the forced --host is appended last, a user-supplied --host localhost in viteArgs is overridden — there is no CLI-only workaround.
Impact
Local backend dev via vite:watch (HMR, no manual vite:compile) is broken out of the box on IPv6 hosts. Affects every plugin/theme using the Vite pipeline.
Proposed fix
Make the bound host configurable, defaulting to a reachable host so local dev "just works", while keeping all-interfaces binding available for LAN/container use:
// signature
{--host=localhost : Host the Vite dev server binds to and advertises in the hot file}
// createCommand$command[] = '--host';
$command[] = $this->option('host'); // localhost by default; pass --host=0.0.0.0 for LAN
Tradeoff: changes the default bind from all-interfaces to localhost. LAN/Docker users opt back in with --host=0.0.0.0. Alternative (no behavior change): keep the bare --host but overwrite the hot file with a reachable URL after the server resolves — messier; the option approach is cleaner and self-documenting.
Immediate workaround (no core change)
After starting the watch, overwrite the hot file with a reachable URL (the server does listen on localhost even when bound to all interfaces):
/cc @jaxwilko — flagging for evaluation since this stems from the --host behavior in the original vite command abstraction. Happy to open a PR for the option-based fix if you agree with the approach.
Activity
Document vite:watch HMR loop and its IPv6 hot-file gotcha
Document the fast browser-MCP + vite:watch HMR iteration loop