rewrites

January 29, 2019 ยท View on GitHub


This callback will iterate the assets, and externals array in service worker file generated by the plugin. This will help developers to modify assets for various scenarios such as multiple cdn domains for assets.


rewrites: function(asset) {	
    if (asset.endsWith('html')) {
        return 'https://www.qq.com/' + asset;
    } else {
        return 'https://s1.url.cn/' + asset;
    }

    return asset;
}