Laravel Valet is supposed to be used on Mac OS, not Windows. I would recommend you try using one of the other more appropriate development environment techniques such as Herd. Why use a fork to eat a bowl of soup?
Laravel valet - vite server refuses to connect
I have a Laravel project using Vue and Inertia(Jetstream oriented).
I am serving the application through Laravel Valet on Windows machine.
When I run npm run dev Vite builds the assets, but when I go to the browser I get a blank page.
When I open up Chrome devtools, I see this error:
GET https://blog.test:5173/@vite/client net::ERR_CONNECTION_REFUSED
blog.test/:20
GET https://blog.test:5173/resources/js/app.js net::ERR_CONNECTION_REFUSED
blog.test/:20
GET https://blog.test:5173/resources/js/Pages/Welcome.vue net::ERR_CONNECTION_REFUSED
I only can only see my code updates(Vue components) after running "npm run build", but I need "npm run dev" working to see real time refresh. (or don't want to delete hot file in /public directory) Everything else seems working correct except above issue - "npm run dev" is not working.
VITE v5.1.6 ready in 388 ms
➜ Local: https://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
LARAVEL v10.42.0 plugin v1.0.2
➜ APP_URL: https://blog.test
I've already secured the blog.test domain using "valet secure blog" command. Also, updated /etc/hosts file: domain blog.test is pointing to 127.0.0.1.
Here is my current vite.config.js file.
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import vue from "@vitejs/plugin-vue";
export default defineConfig({
server: {
https: true,
hmr: {
host: "blog.test",
},
},
plugins: [
laravel({
input: "resources/js/app.js",
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
});
Please let me know how to fix the error.
Please or to participate in this conversation.