require.js - How can I set a version on required modules as part of the URL?

Posted by Ovesh on Stack Overflow See other posts from Stack Overflow or by Ovesh
Published on 2012-12-12T05:01:11Z Indexed on 2012/12/12 5:03 UTC
Read the original article Hit count: 118

I am using require.js to require JS modules in my application.

I need a way to bust client cache on new JS modules, by way of a different requested URL.

i.e., if the file hello/there.js has already been cached on the client, I can change the file name to force the browser to get the new file.

In other words, for the module hello/there, I'd like require.js to request the url hello/there___v1234___.js (the file name can look different, it's just an example), according to a version string which is accessible on the client.

What is the best way to achieve that?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about requirejs