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?
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
For Ext 5 user, you can specify "overrides folder" in app.json. Example:
"overrides": "${app.dir}/overrides",
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
}
});
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
add the ,${app.dir}/overrides in the sencha.cfg
add the requires in the app.js inside the Ext.application
Tested in Sencha Cmd v4.0.2.67
Related
I want to use Ext.ux.colorpick.Field (modern toolkit), but can not figure out what should I require for it to work.
I've tried ext-ux-colorpick package within app.json, but it leads to an error:
Failed to resolve dependency Ext.form.field.Picker for file Ext.ux.colorpick.Field.
Any suggestions?
If you want to use ux widgets you need to require it in app.json like:
"requires": [
"ux"
],
And in app.js or in some Ext.app.Controller add in requires.
requires: ['Ext.ux.colorpick.Field']
Solution was to:
1 - Install package with npm install #sencha/ext-ux (not globally).
2 - Change packages path in the workspace.json to ${workspace.dir}/node_modules/#sencha:
"packages": {
"dir": "${workspace.dir}/node_modules/#sencha",
"extract": "${workspace.dir}/node_modules/#sencha/remote"
}
3 - Add ux to the requires in the app.json.
I have a plugin (FirstPlugin).
The plugin loads a second plugin (SecondPlugin) from its bootstrap and they work both fine.
Now I'm writing tests for FirstPlugin and I need to load SecondPlugin into tests.
So in the bootstrap for test (FirstPlugin/tests/bootstrap.php) I just require the main bootstrap (FirstPlugin/config/bootstrap.php):
require ROOT . 'config' . DS . 'bootstrap.php';
I do this because I also need other bootstrap code (constant, cache settings, etc.).
This doesn't work and I can't understand which is the matter.
Note I have already modified the composer.json for FirstPlugin:
"autoload": {
"psr-4": {
"FirstPlugin\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"FirstPlugin\\Test\\": "tests",
"SecondPlugin\\": "vendor/second-plugin-path/src"
}
},
and the SecondPlugin is installed via composer and located into vendor/.
EDIT
The exception is thrown here:
http://api.cakephp.org/3.2/source-class-Cake.Core.Plugin.html#149
This means $config['path'] is empty.
The problem I think is this:
http://api.cakephp.org/3.2/source-class-Cake.Core.Plugin.html#134
Maybe in the bootstrap of test I must set manually the configuration value?
Solved.
Missing file vendor/cakephp-plugins.php.
I noticed that this file is not created for the plugin, but only for the app. Strange.
I'm using AngularJS ngBoilerplate and trying to add my module. I placed file mymodule/mymodule.js with code
angular.module( 'mymodule', [] );
in common directory. I added path to file in build.config.js, then add it to app.js dependencies:
angular.module('app', [ ..., 'mymodule'
then run grunt build and got:
Iceweasel 24.7.0 (Linux 0.0.0) AppCtrl isCurrentUrl should pass a dummy test 1 FAILED
minErr/<#/var/www/angular/vendor/bower/angular/angular.js:68
loadModules/<#/var/www/angular/vendor/bower/angular/angular.js:4379
forEach#/var/www/angular/vendor/bower/angular/angular.js:336
loadModules#/var/www/angular/vendor/bower/angular/angular.js:4339
createInjector#/var/www/angular/vendor/bower/angular/angular.js:4265
workFn#/var/www/angular/vendor/bower/angular-mocks/angular-mocks.js:2409
script mymodule.js included in page correctly.
What am I doing wrong?
Are you sure you want to place the nodule in the common directory ? I'm not sure about what you're trying to achieve. However, to get up and running with a custom module in ngbp, I would suggest that you create a new folder under src/app called mymodule. Next create a mymodule.js under the newly created directory. Finally, add your code to the file:
angular.module( 'mymodule', [
....
]);
And add the module to the src/app/app.js
angular.module('app', [ ..., 'mymodule']);
The grunt build should be working at this stage.
I found answer! Adding path mask for my module to karma-unit.tpl.js solve the problem.
I'm trying to create a simple grid in my sencha project that extends 'Ext.grid.Panel'.
When I make from sencha cmd the "sencha app build" command, I have the exception: "Unknown definition for dependency : Ext.grid.Panel".
Actually I don't have it in my sencha folder, so how can I add it?
Thanks in advance
Just like this inside the app.js
Ext.application({
name: 'AppName',
requires: [
'Ext.grid.Panel',
'Ext.MessageBox'
]
...
I'm getting following error when i execute sencha app build
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: com.sencha.exceptions.ExBuild: Failed to find any files for extjs-build\app\app\Application.js::ClassRequire::Object
extjs-build\app\app\Application.js looks like
Ext.define('PM.app.Application', {
extend: 'Ext.app.Application',
requires: [
'PM.Object'
]
}
A file for class PM.Object exists. The path is: extjs-build\app\Object.js and extends Ext.Object with some extra functions:
PM.Object = Ext.apply(Ext.Object, {
...: function() {}
}
The extjs-build\.sencha\app\sencha.cfg file:
# The path(s) to application javascript sources (comma separated)
app.classpath=${app.dir}/app
My Directory looks like:
/extjs-build/
.sencha/
app/
app/
Application.js
data/
SomeStore.js
app.js
Object.js
ext/
src/
I'm running sencha app build from /extjs-build/
Ext.Loader handles the issue correct (/extjs-build/app/app.js)
Ext.Loader.setConfig({
paths: {
'PM': './extjs-build/app'
}
});
Ext.application('PM.app.Application');
Any suggestions?
Your PM.Object path (extjs-build\app) is outside the build directory of you app (extjs-build\app\app)
I suspect you are running sencha app build in extjs-build\app which means the compiler will look for js files in extjs-build\app\app\ (this is because app.classpath=${app.dir}/app)
In your sencha.cfg you can change the classpath. Or move that file into the extjs-build/app/app directory.
I solved this issue by adding an empty
Ext.define('PM.Object', {
});
in file extjs-build/app/Object.js.