I'm working with ExtJS 4.x and Sencha Architect 2.2 but this should be relevant to later versions and any application that uses the Ext.Loader
class to dynamically load scripts, including Sencha Touch.
By default Ext.Loader
adds a ?_dc=... cache busting parameter to make sure that the latest version of each script is loaded into the browser. When deploying to a production or beta-test environment this is a good thing as it ensures the user/tester gets the latest script each time you deploy and update, but for a development environment this is not really necessary because developers know to use browser techniques like ctrl+F5 to force a reload of all the scripts. What's more the cache busting gets in the way of debugging as breakpoints etc are lost whenever you reload the app in the browser.
Cache busting is disabled by setting disableCaching to false in the Ext.Loader
configuration. For example:
Ext.Loader.setConfig({
enabled: true,
disableCaching: false
});
In this snippet the dynamic loading is enabled and cache busting is disabled. There are however other config options as described in the API docs here.
In Sencha Architect this code is generated for you in app.js and you can't edit it. Architect has a "Project Setting" to enable caching but in version 2.2 it doesn't work for ExtJS 4. I assume it works fine in later versions but it seems to be all-or-nothing so you have to remember to switch it off and rebuild for deploying to a non-dev environment.
What I want is to be able to:
- Workaround the settings bug in version 2.2 of Architect
- Enable cache busting in "production" but not in dev without having to rebuild my app