b_g0ag
Last Updated: February 25, 2016
·
2.151K
· kennu
F8828772ff141a7cb8fe109af7948da1

Cache-bust Require.js scripts when developing locally

Developing JavaScript (or CoffeeScript) with Require.js can be very frustrating because the browser tends to cache previous versions of scripts until you clear the cache.

However, you can bust the cache by adding this configuration option to Require.js:

requirejs.config
  urlArgs: new Date().getTime().toString()

That will cause all files to be loaded with a timestamped query string, thus bypassing the browser cache.

Say Thanks
Respond