Hot reloading not working with laravel/sail [laravel 8]
See original GitHub issue- Laravel Mix Version: 5.0.9
- Node Version (
node -v
): v15.5.0 - NPM Version (
npm -v
): 7.3.0 - OS: Windows with Ubuntu 20.04 WSL2
Description:
Hot reloading is not working using laravel/sail.
Steps To Reproduce:
I have tried with sail npm run watch
sail npm run hot
and nothing seems to work.
Also when I run npm run hot
it output this:
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from http://localhost:8080/
ℹ 「wds」: Content not from webpack is served from /var/www/html/public
ℹ 「wds」: 404s will fallback to /index.html
but clicking on http://localhost:8080/
actually opens http://localhost:14252/
which is so weird.
I also tried to add EXPOSE 8080
to the Dockerfile
and 8080:8080
to the docker-compose.yml
then I rebuilt the image and but still not working and I can’t see any side effect.
Any blade template I made changes on and save it, there is no autoreload on any browser. I have to activelly reload the page to check every change I made.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:30 (3 by maintainers)
Top Results From Across the Web
Hot reloading not working with laravel/sail [laravel 8] #2719
So I added laravel. test to my Hosts file (resolve to 127.0. 0.1 ) and then I reloaded the page and I finally...
Read more >How To Fix Laravel Sail Hot Reloading (HMR) Not Working Error
Run npm run watch with Laravel Sail. Open the web browser and access the Laravel application with port 3000. Such as http://localhost:3000. Now ......
Read more >Cannot get hot reload to work with Laravel Sail, Vite and Vue 3
After many hours, I have been unable to get hot reload working with Vite on Laravel Sail. The following is my vite.config.ts file:...
Read more >Quick Tip Laravel Mix Hot-Reloading in Sail with Browsersync
Modify webpack.mix.js. Add the following lines to the webpack.mix.js , for enabling BrowserSync. mix.browserSync({ proxy: 'localhost',
Read more >Hot reloading not working with laravel/sail [laravel 8] -
Laravel Mix Version: 5.0.9; Node Version ( node -v ): v15.5.0; NPM Version ( npm -v ): 7.3.0; OS: Windows with Ubuntu 20.04...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @moracabanas, I have gotten one step closer to getting this working by:
8080:8080
to the dockerdocker-compose.yml
as you mentioned (EXPOSE 8080
isn’t required)webpack.mix.js
:Now when I run
sail npm run hot
I can see that it picks up changes as I make them, and my javascript is now loading the first time in the browser. But currently my browser isn’t picking up and replacing the new ‘hot’ javascript parts.I will report back if I figure out how to solve this next issue.
Edit:
sail npm run watch
is a work around for me at the moment which works okay. Yet to figure out how to get HMR working though.What finally, simply worked for me was the following:
8080
port binding todocker-compose.yml
:devServer
setting towebpack.config.js
:Note that the
hmrOptions
stuff inwebpack.mix.js
isn’t necessary, because it already defaults to usinglocalhost
and8080
.