View Full Version : ext-dev.js fails where ext-all-dev.js works. Why?

15 Dec 2011, 8:37 PM
When I try to use ext-dev.js, I get these errors:

ext-dev.js:6745 (http://cadence:8000/static/viewer/extjs/ext-dev.js)[Ext.Loader] Synchronously loading 'IHawk.viewer.data.LockBoxProxy'; consider adding Ext.require('IHawk.viewer.data.LockBoxProxy') above Ext.onReady
ext-dev.js:9405 (http://cadence:8000/static/viewer/extjs/ext-dev.js)[E] Cannot create an instance of unrecognized class name / alias: IHawk.viewer.data.LockBoxProxy
ext-dev.js:9411 (http://cadence:8000/static/viewer/extjs/ext-dev.js)

ext-dev.js:9417 (http://cadence:8000/static/viewer/extjs/ext-dev.js)console.trace()

logext-dev.js:9417 (http://cadence:8000/static/viewer/extjs/ext-dev.js)
Ext.Error.Ext.extend.statics.raiseext-dev.js:8705 (http://cadence:8000/static/viewer/extjs/ext-dev.js)
Ext.ClassManager.instantiateext-dev.js:6755 (http://cadence:8000/static/viewer/extjs/ext-dev.js)
(anonymous function)ext-dev.js:2468 (http://cadence:8000/static/viewer/extjs/ext-dev.js)
(anonymous function)stores.js:14 (http://cadence:8000/ImageHawk/Cadence/viewer/data/stores.js?_dc=1324009662015)

When I use ext-all-dev.js, it works as expected. The only change from one to the other is the inclusion of the different scripts named here.

These are all the error messages I get. Doing what they say changes nothing. I can breakpoint on the Ext.define() in the named file, so I know it is happening, it just doesn't seem to register the class like ext-all-dev.js does.

What am I doing wrong?

16 Dec 2011, 5:26 AM
I think it has to do with the new dynamic resource loading mechanism in ExtJs 4, where the library version you include may (or may not) enable dynamic loading.
You can manually enable dynamic loading by adding the following command just before your declare your Ext.application({}) object:


Prior to publishing a production app, you'll obviously want to revist this and possibly use the 'requires: []' mechanism in your app's classes.

16 Dec 2011, 7:23 AM
The last lines of ext-dev.js are:

enabled: true,
disableCaching: true,
paths: {
'Ext': 'Ext/' + path + 'src'

I had to adjust the paths to deal with my server setup, but all the rest of it is just as it came from Sencha.

My classes are being dynamically loaded, I can see them in the network tab, just for some reason, they never register unless I use Ext-all-dev which is still a freaking HUGE file.

16 Dec 2011, 8:25 AM
Doing what they say changes nothing.

Does it really change nothing or does it make that first warning disappear?

My guess would be that your classes don't specify their ExtJS dependencies correctly using requires/uses. This isn't a problem using ext-all-dev.js as it loads the whole library anyway but using ext-dev.js it'll only load bits of the library as needed.

The second biggest cause of problems like this is a spelling mistake in a class name or file name. Double check everything is right, including capitalization.

Don't edit the contents of ext-dev.js to switch the paths, just set the paths to something else straight after you include the library.

16 Dec 2011, 8:58 AM
Oh Hi! I was reading your website just the other day. Nice writing.

I've called myself checking everything and yes, it really does work when using ext-all-dev. It could be a lack of require/uses though. I'll check that again. Would be nice if there was a method you can call on an object to get that list (that would seem VERY useful)

I've set a breakpoint on the set: method where the names are added to the ClassManager and using ext-dev, my classes never get registered, this is never called unless I use ext-all-dev.


* Sets a name reference to a class.
* @param {String} name
* @param {Object} value
* @return {Ext.ClassManager} this
set: function(name, value) {
var targetName = this.getName(value);

this.classes[name] = this.setNamespace(name, value);

if (targetName && targetName !== name) {
this.maps.alternateToName[name] = targetName;

return this;

I think it might have to do with this which has been identified as a bug.



16 Dec 2011, 9:11 AM
I think if it were that bug then it would be fixed by putting in the Ext.require before the onReady. Perhaps it's a combination of that bug plus the lack of a requires on your class definition?

That said, I'm surprised you don't even get an error thrown during class creation. Perhaps it's worth stepping in with a debugger to see where the Ext.define call goes wrong?