Problems getting Stealjs cache-bust to work


I am having trouble getting the stealjs cache-bust extension to work in production.

I have the following line in my index.html

<script bundles-path="dist/bundles" src="/node_modules/steal/steal.production.js" data-main="app/app" cache-version="1"></script>

I see the following when the resources are loaded in the browser…


I was expecting to see “?version=1” appended to the app.js resource too.

In the development version it all works as expected. I see the timestamp appended to all the resources.

Here is an extract from my package.js:

  "dependencies": {
    "can": "2.3.27",
    "steal": "0.15.5",
    "steal-cache-bust": "0.2.1",
    "steal-css": "0.4.1",
  "system": {
    "configDependencies": [

Any help or pointers to a solution will be much appreciated!


is it necessary to use steal 0.15 ?
can u use 0.16?

Thanks pYr0x
I just updated to steal 0.16.43 and I still see the same thing.

hello @robfoweraker
i have looked into this.

of course it is a design failure.

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

my thoughts:
either we integrate steal-cache-buster into core and enable it by setting the steal config
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

Thanks again @pYr0x

Should I raise an issue somewhere?

i did

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, load);
	function isProduction() {
		return loader.isEnv && loader.isEnv('production') || loader.env === 'production';
if (typeof System !== "undefined") {

Thanks again. I will give it a go

Thanks pYr0x,

but steal.production.js be got from npm or bower, why do we to edit at this file?

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…

but you can also workaround by adding the cache buster file after steal… see matthew’s comment

thanks pYr0x so much

Any updates on this?
I add steal.production.js and cach-bust.min.js like this on my page.

<script type="text/javascript" 
<script type="text/javascript" 

Steal then loads main.js and main.js loads main.css.
But only main.css is loaded with the cache-key/version. (main.css?rev=f840…)

we released a new steal version 1.2.0 pre.2
the cachebust is now a core module
check out docs

:+1: Steal 1.2.0 solves this issue!
Great work guys!

1 Like