Expire cache on require.js data-main

前端 未结 2 1525
广开言路
广开言路 2020-12-23 13:37

I\'m using require.js and r.js to package my AMD modules. I\'m using jquery & requirejs via the following syntax:



        
2条回答
  •  抹茶落季
    2020-12-23 14:21

    Here is my solution (for emergency) :

    1. Find the following code in require.js:

    Development version

    //Join the path parts together, then figure out if baseUrl is needed.
    url = syms.join('/');
    url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'));
    url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
    

    OR

    Production version

    e).join("/"),h=m(d,h)){H(h)&&(h=h[0]);a.splice(0,e,h);break}d=a.join("/");d+=b||(/^data\:|\?/.test(d)||c?"":".js");
    
    1. and add ?v=x.0 after the .js

      url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js?v=1.0'));

      OR

      (/^data\:|\?/.test(d)||c?"":".js?v=1.0");

提交回复
热议问题