Rails 6 server just stopped compiling webpack

So, I actually ran into this today and after reading this question and doing some additional debugging, I realized the Rails Webpacker was failing because I had another project already running Webpacker and that confused the Rails version.

Shutting down the other Webpacker and restarting the Rails server immediately fixed the issue.


Experiencing this as well. Typically when running rails s you'll see something like this:

Started GET "/react_test/hello" for ::1 at 2020-05-15 16:54:29 -0700

Processing by ReactTestController#hello as HTML
  Rendering react_test/hello.html.erb within layouts/application

[Webpacker] Everything's up-to-date. Nothing to do

If you make a change to a js (or css/scss) that are part of your webpack resources:

Processing by ReactTestController#hello as HTML
  Rendering react_test/hello.html.erb within layouts/application
[Webpacker] Compiling...
[Webpacker] Compiled all packs in /Users/foo/public/packs
[Webpacker] Hash: 1ea802b336ed3c771c61
Version: webpack 4.43.0
Time: 4844ms

... truncated for brevity (a list of assets, size, etc)

At some point, all of this stops - and you'll "have" to run both rails s and ./bin/webpack-dev-server manually. So far, what I've noticed is that this is triggered when you run webpack-dev-server - e.g. when updating config/webpacker.yml - it does say it on that file itself in a note:

# Note: You must restart bin/webpack-dev-server for changes to take effect


Try this workaround:

  1. Stop Rails server and webpack-dev-server
  2. Make some (temporary) change to your /app/javascript/packs/application.js file
    • e.g. comment out an import: //import 'bootstrap'
  3. Restart rails s (only, not webpack-dev-server)
  4. This will error out - because it's missing what was commented out (in this example bootstrap
  5. Undo/uncomment the temporary change
  6. Reload the page - hopefully, it should be good (Webpack compiles, etc).

I think (guess) it's some caching/sync issue that is "fixed/(reset?)" by making some change to application.js

Hth...


If webpacker stops responding to changes in application.scss or application.js, run this command in terminal:

rails webpacker:install