我有一个使用Aurelia编写的单页应用程序。它很棒。
但是,当我推出更新时,有时很难让浏览器刷新缓存的页面,因此它显示的是旧版本。
尝试过,刷新浏览器,控制F5。
还把它放在index.html的头部
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
但是我不认为system.js会抓取上面会产生影响的各个组件。
答案 0 :(得分:1)
经过一些搜索,我发现this解释了如何使用SystemJs缓存 -
var systemLocate = System.locate;
System.locate = function(load) {
var System = this;
return Promise.resolve(systemLocate.call(this, load)).then(function(address) {
if(address.lastIndexOf("html.js") > -1) return address;
if(address.lastIndexOf("css.js") > -1) return address;
return address + System.cacheBust;
});
};
System.cacheBust = '?bust=' + Date.now();
System.import('aurelia-bootstrapper');