From b4b4ecf1f55e0a91b1be86c6c5113740c05e0fe9 Mon Sep 17 00:00:00 2001 From: CoRNeRNoTe Date: Mon, 11 Mar 2024 11:38:09 +1030 Subject: [PATCH] document adding server.hmr.host=localhost to vite.config.js --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index b9a2b4b24..461d9d7ef 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,21 @@ This configuration should be able to compile assets with both [laravel mix](http }, ``` +When running the Vite development server within docker on Windows Subsystem for Linux 2 (WSL2), you should add `server.hmr.host=localhost` to your `vite.config.js` file to ensure the browser can communicate with the development server: + +```js +// ... + +export default defineConfig({ + // ... + server: { + hmr: { + host: 'localhost', + }, + }, +}); +``` + Then, run the following commands to install your dependencies and start the dev server: - `docker-compose run --rm npm install`