使用aurelia软件包修订清除浏览器缓存

时间:2017-04-19 14:15:47

标签: aurelia browser-cache

每当我发布(AWS)时,我的 app-build.js 捆绑包上都会出现 404 。浏览器引用以前的捆绑包修订(例如,dist / app-build-cf4 ...)。

即使使用新的软件包修订号并使用" System.cacheBust"在app-build文件中,它仍然坚持旧的rev#。

我必须手动清除缓存才能加载网站。

Index.cshtml

...
<body aurelia-app="main" class="page">
<div>      
    <div class="splash text-darker-clr" >
        <div class="message">                
            <span>Site</span>
            <br />
            <div id="ajax-loading-screen" data-disable-fade-on-click="0" data-effect="standard" data-method="standard">

                <div class="loading-icon">                        
                    <span class="fa fa-circle-o-notch fa-spin spin"></span>
                </div>
            </div>
        </div>
    </div>

    <script src="jspm_packages/system.js"></script>
    <script src="config.js"></script>

    <script>
        var systemLocate = System.locate; System.cacheBust = "?bust=" + Date.now(), System.locate = function (a) { var b = this; return Promise.resolve(systemLocate.call(this, a)).then(function (a) { return a.lastIndexOf("html.js") > -1 ? a : a.lastIndexOf("css.js") > -1 ? a : a + b.cacheBust }) };
        System.import('aurelia-bootstrapper');
    </script>      
</div>
</body>

bundles.js

module.exports = {
"bundles": {
"dist/app-build": {
  "includes": [
    "[**/*.js]",
    "**/*.html!text",
    "**/*.css!text"

  ],
  "options": {
    "inject": true,
    "minify": true,
    "depCache": true,
    "rev": false
  }
},
"dist/aurelia": {
  "includes": [
    "aurelia-framework",
    "aurelia-bootstrapper",
    "aurelia-fetch-client",
    "aurelia-router",
    "aurelia-animator-css",
    "aurelia-templating-binding",
    "aurelia-polyfills",
    "aurelia-templating-resources",
    "aurelia-templating-router",
    "aurelia-loader-default",
    "aurelia-history-browser",
    "aurelia-logging-console",
    "bootstrap",
    "bootstrap/css/bootstrap.css!text",
    "fetch",
    "jquery",
    "moment",
    "aurelia-bootstrap-datepicker",
    "aurelia-authentication",
    "aurelia-api",
    "aurelia-dialog"
  ],
  "options": {
    "inject": true,
    "minify": true,
    "depCache": false,
    "rev": false
  }
}
}
};

enter image description here

0 个答案:

没有答案