How to use the 'overrides' folder generated by Sencha cmd for an Ext JS 4 project

十年热恋 提交于 2020-01-04 04:35:07

问题


I have generated a project using Sencha cmd. This creates a nice folder named 'overrides' where I have put my overridden Ext.Ajax class. I then include it in my app.js file like so

requires: [
    'overrides.Ajax'
]

This works just fine when using my app, however when I try to build it using Sencha cmd I get the following error:

[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.BasicException: The following error occurred while e
xecuting this line:
[ERR] Z:\public_html\LoginScreen\.sencha\app\build-impl.xml:469: com.sencha.exce
ptions.ExBuild: com.sencha.exceptions.ExBuild: Failed to find any files for Z:\p
ublic_html\LoginScreen\app\app.js::ClassRequire::overrides.Ajax

Does anyone know how to properly include files that are inside the overrides folder?


回答1:


Turns out I needed to edit the .sencha/app/sencha.cfg file, adding the following to the end of the app.classpath

,${app.dir}/overrides

Thanks to Mitchell over at the official Sencha forums for helping me out! http://www.sencha.com/forum/showthread.php?261361-Properly-using-the-overrides-folder-generated-by-Sencha-Cmd-for-Ext-Js-4.2




回答2:


For Ext 5 user, you can specify "overrides folder" in app.json. Example:

"overrides": "${app.dir}/overrides",



回答3:


You probably need path defined in your loader config for overrides.

Something like this:

Ext.Loader.setConfig({
    paths: {
        'Ext.ux': 'js/extjs/ux',
        'overrides' : 'somepath/to/overrides',
        'Skirtle.CTemplate':'js/extjs/ux/SkirtleCTemplate.js' //<-- specific component
    }
});



回答4:


For me just the

requires: [
    'overrides.Ajax'
]

didn't work I had to add

requires: [
    'MyApp.overrides.Ajax'
]

And it worked :)

Also the vars

// @require @packageOverrides
// @require @appOverrides

don't do anything for me, so the steps are

  1. add the ,${app.dir}/overrides in the sencha.cfg
  2. add the requires in the app.js inside the Ext.application

Tested in Sencha Cmd v4.0.2.67



来源:https://stackoverflow.com/questions/16023619/how-to-use-the-overrides-folder-generated-by-sencha-cmd-for-an-ext-js-4-projec

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!