Require.js not updating in browser

I am having problems developing an application with require.js. Whenever I edit a javascript file and save it in my code editor, the browser does not seem to register the change. I can refresh the page, but it still runs the old code. The issue is fixed by closing the tab and reopening the page, but there should be an easier way to do this. Has anyone else had this problem, and how did you fix it?

Thanks in advance!

+4
source share
1 answer

Add this to the file you specify as data-main (in most cases main.js ). Add this to the first line:

 require.config({ urlArgs: "ts="+new Date().getTime() }); 

Please note that this must be removed for production.

+8
source

All Articles