Ok let's have a look. First check the browser console for errors. Also check the head tag if that new url is shown twice with different urls in script tags
Laravel 9 (with Sail, Vite, Inertia and Vue ) - HMR not working?
Hi everyone,
I've been a Laracast member for about 4 years and since then I've been able to solve all my problems by reading here on the forum. First of all thank you for that.
But now I have to ask a first question and I hope you can help me. This week I started a new project based on Laravel 9. My intention is to use Inertia with Vue.js, as well as Vite, which is obviously standard in laravel by now. I hope I can make you understand my problem by describing it as best i can. (Excuse my bumpy English, and Sorry for the long Text)
That’s what I have done to test the behavior: First i set up a complete new Laravel-App as follows:
curl -s "https://laravel.build/laraTest" | bash
cd laraTest
sail up -d
sail composer require laravel/jetstream
sail artisan jetstream:install inertia
sail artisan migrate
As you see, i have done nothing special and i have especially not changed anything.
Now i start Vite:
sail npm run dev
-> it starts and shows:
VITE v3.0.9 ready in 2564 ms
➜ Local: http://localhost:5173/
➜ Network: http://172.19.0.7:5173/
LARAVEL v9.25.1 plugin v0.5.4
➜ APP_URL: http://laraTest.test
So far, so good.
The Link http://laraTest.test does not work (which i think is correct, as i use Sail).
The Link http://localhost:5173 shows a Vite Page with Infos (which i think you know)
Next i open http://localhost in Browser (Chrome) and the Laravel Welcome Page appears as expected. Perfect!
Now i change some Text in „Welcome.vue“ in resources/js/Pages Directory (e.g. change Documentation -> HELLO).
The Change is unfortunately not reflected in the Browser, even not if i force the reload of the Page.
If i stop Vite (CTRL+c) and restart it (npm run dev) then the change ist reflected. But this is realy boring.
If i change the app.blade.php in resouces/views (e.g. put a HELLO in the body (before @inertia), this change is reflected in Browser, but only if I force to reload.
So I assume that HMR is not working with Vue-Files in a vanilla Laravel-Installation with Sail Inertia and Vue? Maybe something in the Configuration is wrong, but I do not know where. I tried to find it out for myself, spent many hours and tried each Tipp i found, but no success so far. What am I doing wrong?
In case it matters, I'm working on a Macbook Pro (Monterey) with Intellij IDEA Ultimate.
Many thanks in advance for your support
Reinhard
Please or to participate in this conversation.