防止RequireJS缓存加载的js包 | Prevent RequireJS from Caching Required Scripts

RequireJS can be configured to append a value to each of the script urls for cache busting. 

From the RequireJS documentation (http://requirejs.org/docs/api.html#config):

urlArgs: Extra query string arguments appended to URLs that RequireJS uses to fetch resources. Most useful to cache bust when the browser or server is not configured correctly. 

Example, appending "v2" to all scripts:

For development purposes, you can force RequireJS to bypass the cache by appending a timestamp:

 

from:http://stackoverflow.com/questions/8315088/prevent-requirejs-from-caching-required-scripts

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注