我使用sencha命令创建了一个“common”的sencha包:
sencha generate package common
并将一个文件放在名为“mytext.js”的workspace / packages / local / src中:
Ext.define('Common.mytext',{
extend: 'Ext.form.field.Text',
xtype: 'mytext',
initComponent: function(){
Ext.apply(this,{
onBlur: function(){
//Set The corrected value for the field
}
});
this.callParent(arguments);
}
});
在我的主应用程序中,我在app.json文件中包含了“common”的要求。
当我执行sencha app refresh
时,我收到以下依赖项错误:
[ERR] Failed to resolve dependency Ext.form.field.Text for file Common.mytext
[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExNotFound: Unknown definition for dependency : Ext.form.field.Text
[ERR]
[ERR] Total time: 1 second
[ERR] The following error occurred while executing this line:
/home/xxxxxxxxx/bin/Sencha/Cmd/6.0.2.14/plugins/ext/current/plugin.xml:427: The following error occurred while executing this line:
/var/www/xxxxxx/apps/client/.sencha/app/build-impl.xml:381: The following error occurred while executing this line:
/var/www/xxxxxx/apps/client/.sencha/app/init-impl.xml:382: com.sencha.exceptions.ExNotFound: Unknown definition for dependency : Ext.form.field.Text
我错过了一些配置吗?感谢。
答案 0 :(得分:0)
您可能需要将框架添加到package.json中。
尝试一下:
"framework": "ext"
https://docs.sencha.com/cmd/6.x/cmd_packages/cmd_creating_packages.html#framework
或者您可以尝试在此处定义框架:.sencha / package / sencha.cfg,添加:
package.framework=ext