steal-cache-bust is working on development because steal knows that this is a config dependency. it loads steal-cache-bust before the index.js is loaded.
in production steal-cache-bust is bundled into the index.js file and steal therefore cant be load the index.js file with the cache-bust extension because it dont know that cache-busting is enabled.
for any future files, steal will load these files with a version number
@matthewp
my thoughts:
either we integrate steal-cache-buster into core and enable it by setting the steal config
or
we add (in steal 1.0) the fetch hook into the steal.production.js that we copied into the dist folder and remove cache-buster from being bundled
you can workaround by use stealBundle=true while building and use the bundled steal version.
or you can add in the steal.production.js at the end following:
function _SYSTEM_addCACHE(loader) {
var fetch = loader.fetch;
var timestamp = new Date().getTime();
var isBuildEnvironment = loader.isPlatform ? loader.isPlatform('build') || loader.isEnv('build') : typeof window === 'undefined';
loader.fetch = function (load) {
var loader = this;
var cacheVersion;
var cacheKey;
var cacheKeyVersion;
if (!isBuildEnvironment) {
cacheVersion = isProduction() ? loader.cacheVersion || timestamp : timestamp;
cacheKey = loader.cacheKey || 'version';
cacheKeyVersion = cacheKey + '=' + cacheVersion;
load.address = load.address + (load.address.indexOf('?') === -1 ? '?' : '&') + cacheKeyVersion;
}
return fetch.call(this, load);
};
function isProduction() {
return loader.isEnv && loader.isEnv('production') || loader.env === 'production';
}
}
if (typeof System !== "undefined") {
_SYSTEM_addCACHE(System);
}
why do you have to edit this file?
because if you did not, the cache buster plugin didn’t work. but you dont have to modifiy your steal at all, see below…