For some reason, Sencha Cmd fails when it parses app.js with custom code. Below, is a snippet from an application I'm deploying to testing (unminified JavaScript but in a single file) or to production (minified JavaScript).
The browser throws the following JavaScript exceptions from the deployed folder (with all-classes.js):
(note: the folder with all js source code runs fine)
GET http://localhost/App/App/model/app/CheckTreeNode.js?_dc=1396967410158 404 (Not Found) all-classes.js:10841
GET http://localhost/App/App/store/app/UserPreferenceNodes.js?_dc=1396967410159 404 (Not Found) all-classes.js:10841
GET http://localhost/App/app/controller/ViewportAdmin.js?_dc=1396967410177 404 (Not Found) all-classes.js:10841
...
Uncaught Error: [Ext.Loader] Failed loading 'App/model/app/CheckTreeNode.js', please verify that the file exists all-classes.js:11259
Uncaught Error: [Ext.Loader] Failed loading 'App/store/app/UserPreferenceNodes.js', please verify that the file exists all-classes.js:11259
Uncaught Error: [Ext.Loader] Failed loading 'app/controller/ViewportAdmin.js', please verify that the file exists
I tried fixing things by adding a "requires" config in my Ext.application class, but that didn't help. How can I force these files to be seen by Sencha Cmd? Sencha Touch has a solution by allowing you to add files to "app.json". Perhaps there is a similar solution for ExtJS applications that I'm unaware of?
If there are more elegant solutions, I'm open to them. I needed the user preferences in the constructor of a bunch of my classes, so this was the only place I could get it to load and be ready when those are called. If there is a different way to load data that can be available when building classes within MVC, I'm fine with a different solution for that. As for having two viewports, this is what I found to work, so that's what ViewportAdmin is. Just a second viewport.
app.js source code:
Ext.application({
name: 'App',
extend: 'App.Application',
requires: [
'App.store.app.UserPreferences',
'App.view.ViewportAdmin'
],
autoCreateViewport: false,
launch: function () {
Ext.StoreManager.lookup('App.store.app.UserPreferences').on('load', function () {
if (window.location.href.indexOf('/App/index.aspx?admin=true') > -1) {
Ext.create('App.view.ViewportAdmin');
}
else if (window.location.href.indexOf('/App/index.aspx') > -1) {
Ext.create('App.view.Viewport');
}
});
}
});