Is there a way to disable HMR on JS file change with Bud?


I have problems with the HMR not working correctly when I modify a JS file in my project (using Sage 10, and running via WSL).
The changes seems to be correctly detected and the new code appears to be compiled as well, but nothing changes on my page : I have to reload the page manually myself to see the changes.
(For CSS and Blade files, everything works fine)

I tried using the poll: true for the watchOptions and also tried other solutions after doing some research but nothing seems to work.

That’s why I simply want to disable the HMR functionality and force a full page reload on JS file changes.
How can I do that using Bud ? Is there a hook or an event that I can call to detect js modifications and force the reload myself after compilation ?

Thanks !

I’d like to do this too, did you find any solution?

Edit: for anyone with the same issue, I’m not sure if this is the “proper” way to do this but I just added ‘resources/scripts/**/*’ to the watch function on line 28 of bud.config.js.

@Ekeler that seems like a good solution. When one of those files changes it requests the client middleware to trigger a reload, which is exactly what you’re looking to do:

  action: 'reload',
  message: 'Reloading window',

The fact that stylesheet changes are injected properly leads me to believe there is something in the app code which needs to be modified.

You might try referencing the HMR api docs from webpack:

It’s hard to say more than that without logs. Just a hunch.

Hi @Ekeler,

I ended up using the same technique as you are : by adding 'resources/scripts/**/* to the watch function of my bud.config.js file, and it works well.

Sorry, I should have posted here earlier about it !