Js does not update

I created a util.js file and added it to hooks.py. It worked the first time, but after I make changes to util.js, the updates are not reflected in the browser.

Currently, I have to rename the JS file and run bench restart to see the changes, but that’s not a good solution.

How can I properly update or reload the JavaScript file after making changes?

I always face this problem, it is mostly properly related to your web browser cache. The only way i know in ‘Google Chrome’ is as follow (or any equivalent method in other web browsers):

  1. Press 3 Dots on top right of your browser
  2. Got to Settings
  3. Click the ‘Privacy and Security’ section on the left sidebar
  4. Click the ‘Delete Browsing Data’
  5. Just select ‘Cached Images and Files’
  6. press ‘Delete Data
  7. Refresh your ‘ERPNext’ website or use ‘Ctrl +Shift + R’ for Clear Cache Reload
  8. Changes should reflect now in your website immediately

Go to any web page where that js file is used > Right Click > Inspect > Networking > Check Disable Cache. And keep networking tab open, then a refresh will do the work.

1 Like

Worked perfectly with me. Thanks!