View Full Version : Ext.class.requires won't load classes from a correct path

7 Sep 2013, 10:33 AM

I have lots of custom classes in my Ext JS project and they are all - let's say - in the "my_custom_classes/" directory and use "My." namespace. The namespace and the path are being picked up correctly by the bootstrap.js, so there is an entry like this:
"My": "my_custom_classes/".

When I require a custom class via Ext.require at the beginning of the app.js file, it works. When I use the "requires:" config attribute in the Ext.define block (without prior require via the Ext.require method), it tries to load the classes from a path relative to the "app/" directory. I haven't been able to figure out why it doesn't use the loader path.

Is there anything I am missing on how the Ext.class.requires should work? Thank you!

7 Sep 2013, 11:39 PM
Just a quick sanity check, you did enable the loader?

enabled: true

9 Sep 2013, 12:08 AM
If you use Ext.app.Aplication, it will override namespace path. Either configure it with appPath:Ext.Loader.getPath('my') or "paths processed":true.

10 Sep 2013, 12:02 AM
Thank you for your responses!

I settled this with using the "overrides" folder (my custom classes are overrides or extends for the most parts) - then I don't have to require the classes one by one, although I must manually require any custom class that extends another custom class.

The "overrides" folder, as it often happens to be with ext, isn't loaded automatically though because of a bug. I had to do some tweaks in the app and in the sencha cmd source: