Search code examples
ruby-on-rails-6tailwind-csswebpackerwindows-subsystem-for-linux

Webpacker recompiling in a loop


i'm trying to get a Rails 6 project up and running in development. I am using webpacker 6 and tailwindcss 2. For some reason webpacker will start the Compiling process again after each successfull compilation as soon as i open the website. It seems that something is triggering the compiling again but i dont know what it is. I am using WSL 2 on a Windows environment. When i run bin/webpack-dev-server for the first time in a terminal (without opening the website on a browser) i get the expected output and webpacker is just compiling everything as it should be (only compiling once)

But as soon as i go the local running website via my browser webpacker wont stop recompiling even though i didnt change anything in the code. This is my terminal output:

ℹ 「wdm」: Compiling...
ℹ 「wdm」: assets by status 5.05 MiB [cached] 29 assets
asset manifest.json 3.56 KiB [emitted]
webpack 5.39.1 compiled successfully in 531 ms
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
ℹ 「wdm」: wait until bundle finished: /packs/css/application-36e9b2b1.css
ℹ 「wdm」: assets by status 5.05 MiB [cached] 29 assets
asset manifest.json 3.56 KiB [emitted]
webpack 5.39.1 compiled successfully in 673 ms
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
ℹ 「wdm」: assets by status 5.05 MiB [cached] 29 assets
asset manifest.json 3.56 KiB [emitted]
webpack 5.39.1 compiled successfully in 502 ms
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
ℹ 「wdm」: wait until bundle finished: /packs/css/application-36e9b2b1.css
ℹ 「wdm」: assets by status 5.05 MiB [cached] 29 assets
asset manifest.json 3.56 KiB [emitted]
webpack 5.39.1 compiled successfully in 551 ms
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
ℹ 「wdm」: assets by status 5.05 MiB [cached] 29 assets
asset manifest.json 3.56 KiB [emitted]
webpack 5.39.1 compiled successfully in 466 ms
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
ℹ 「wdm」: wait until bundle finished: /packs/css/application-36e9b2b1.css
ℹ 「wdm」: assets by status 5.05 MiB [cached] 29 assets
asset manifest.json 3.56 KiB [emitted]
webpack 5.39.1 compiled successfully in 453 ms
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...

How do i stop webpacker-dev-server from compiling all the time? Or what could be the reason to trigger the compiling again and again?


Solution

  • SOLVED: In case anybody else will get this problem:

    It seems that there was a problem with my bundler version. I had to uninstall my bundler and now just use the default one from rails. I also removed node_modules rm -rf node_modules and reinstall them by running yarn install. That fixed the problem for me.