1

We are having some trouble with RequireJS not grabbing a fresh copy each time it is requested. We have used the following without success:

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

When viewing the network log, the page is loaded with the argument appended to the URL, however if the same page is called again, it doesn't appear in the network log at all, so it is coming from the cache somehow.

If anyone has any ideas, it would be greatly appreciated.

Thanks, Ryan.

Ryan
  • 143
  • 1
  • 2
  • 7

1 Answers1

2

This jsfiddle example shows urlArgs working.

require.config({
    urlArgs: "bust=" + (new Date()).getTime(),
    paths: {
        "jquery": "http://code.jquery.com/jquery-1.9.1"
    }
});

require(["module", "jquery"], function (module, $) {
    console.log($.fn.jquery);
    console.log(module, module.config());
});

With this output:

1.9.1
Object { id="_@r5", uri="./_@r5.js?bust=1365059426478", config=function()} Object {}

And the Net panel in Firebug shows a fresh version of jQuery downloaded each time.

Firebug Net Panel

Which browser(s) are you using?

Paul Grime
  • 14,970
  • 4
  • 36
  • 58