Hi David! Thanks a bunch for your walkthrough. Very helpful!
That being said, when running bin/webpack-dev-server it keeps re-compiling every second. As a result the page keeps refreshing. Any thoughts on how to fix that?
Edit: I think I was wrong below. Here's what worked: try setting compile: false in webpacker.yml and commenting mode: 'jit', in tailwind.config.js. I can run bin/webpack-dev-server, rails s, and guard at the same time now without issue or compile-refresh loops.
This started happening to me after I got tailwind working. Are you running some live-reloading tool? (e.g., I was running bundle exec guard.) If so, try not running that. bin/webpack-dev-server handles livereloading when running, it seems.
NB: webpack-dev-server would almost always compile things twice for me (now) but stops after that (until I make another change).
I also noticed that commenting mode: 'jit', in tailwind.config.js seemed to fix it too, before I stopped running guard.
You can also just not run bin/webpack-dev-server -- rails s will still compile stuff for you and then you can have bundle exec guard in the bg if you prefer that.
I followed above instructions and got the same issue as you did.
I changed the tailwind.config.js a little bit: I did not use ./**/*.html.erb in the purge section but ./app/**/*.html.erb. This solved for me the issue of the recompiling.
Hi David! Thanks a bunch for your walkthrough. Very helpful!
That being said, when running bin/webpack-dev-server it keeps re-compiling every second. As a result the page keeps refreshing. Any thoughts on how to fix that?
All the best,
Oliver
Hey Oliver, thanks so much for the feedback.
What version of Ruby are you running?
I'm experiencing the same issue on Ruby 2.7.3.
same issue on Ruby 3.0.1
Edit: I think I was wrong below. Here's what worked: try setting
compile: false
inwebpacker.yml
and commentingmode: 'jit',
intailwind.config.js
. I can runbin/webpack-dev-server
,rails s
, andguard
at the same time now without issue or compile-refresh loops.This started happening to me after I got tailwind working. Are you running some live-reloading tool? (e.g., I was running
bundle exec guard
.) If so, try not running that.bin/webpack-dev-server
handles livereloading when running, it seems.NB: webpack-dev-server would almost always compile things twice for me (now) but stops after that (until I make another change).
I also noticed that commenting
mode: 'jit',
intailwind.config.js
seemed to fix it too, before I stopped runningguard
.You can also just not run
bin/webpack-dev-server
--rails s
will still compile stuff for you and then you can havebundle exec guard
in the bg if you prefer that.Hi Oliver,
I followed above instructions and got the same issue as you did.
I changed the tailwind.config.js a little bit: I did not use
./**/*.html.erb
in the purge section but./app/**/*.html.erb
. This solved for me the issue of the recompiling.Thanks for that. It was pointed out to me by someone else as well and came here to change it and saw your comment now only. 🤦♂️