View Full Version : SenchaCmd issues with Ext.Loader

29 Nov 2012, 9:21 AM
This problem has been solved. Solution in Post #6.

In short, my application works great with Ext.Loader enabled but not built. However, after disabling Ext.Loader and building my application, it continues to try and load every file that has already been defined in single file that SenchaCmd compiled. It tries to load all of the files with an incorrect path and thus fails.

How can I stop my built, single js file from using Ext.Loader to load all of my classes? All of the classes are already defined in the single js file, but Loader doesn't seem to either notice or care that literally the entire application has already been loaded.

Here's what's happening in Firebug (this is a snippet... it goes on for much longer):

Error: [Ext.Loader] Failed loading 'NS/controller/Authentication.js', please verify that the file existsError: [Ext.Loader] Failed loading 'NS/controller/User.js', please verify that the file exists
Error: [Ext.Loader] Failed loading 'NS/store/Users.js', please verify that the file exists
Error: [Ext.Loader] Failed loading 'NS/view/UserEditor.js', please verify that the file exists

I don't know why it's using NS as the path, as that should have translated to "app".

I have been working on this for days and any help would be appreciated. Thanks!

30 Nov 2012, 2:58 AM
Just to investigate your problem please post the app.js code.

Darren Pruitt
30 Nov 2012, 6:35 AM
Make sure the single file really has all of the classes in it. I just had an issue recently where only the Views were getting combined into the single file and the loader was trying to load each individual Controller file. None of the controllers, stores or models were compiled into the single file.

Between all the stuff I tried I think the two things that worked were:

Refreshing the bootstrap.js:

sencha app refresh

And I had to include the app.js in the compile:

sencha compile -classpath=ext/src,app,resources,app.js
page -name=page -in index.html -out=deploy/index.html
and restore page
and exclude -file ext/src
and concat deploy/appClasses.js

This compiled all the app only files into the single appClasses.js and the loader worked fine after that.

30 Nov 2012, 10:37 AM
Thank you for the responses.

In terms of using

sencha app refresh

I am unable to do that as the application was not initially created with SenchaCmd. If there's a way to force the refresh, I'm not sure how to do it.

I did try creating a bootstrap.js file manually by using the following code:

sencha compile --classpath=ext/src,ext/examples/ux,app,app.js
meta -loader-paths -base-path . -out bootstrap.js
and meta -alternates -append -out bootstrap.js
and meta -alias -append -out bootstrap.js
But when using the bootstrap it never seemed to make a difference error-wise. Ext.Loader was still trying to load all of the classes that were already defined in the single built js file. Maybe I'm building the bootstrap incorrectly; that I'm not sure of.

As far as I can tell, every view, controller, model, etc are listed in the single built js file, including the ones that it tries to load.

2 Dec 2012, 1:30 AM
I had an app not created by CMD. So I recognise the problem build the app. I generated an with the same name and copied all js, css, html, custom pics etc into the new empty app. After that I had no more problems with run CMD commands on the app. Be aware of that generate an app with the same name could overwrite the old one. So move the old app to another map before generate an empty new with the same name.

3 Dec 2012, 9:09 AM
I finally found the solution to be, in my case, this:

sencha compile --classpath=ext/src,ext/examples/ux,app/model,app/store,app/view,app/controller,app/app.js union -recursive -file app/app.js concat all-classes.js

Essentially, I specified the order of the class files and put the "controller" folder at the end. I honestly hope there is a better solution than this, but it worked for me.