PDA

View Full Version : Build error or empty all-classes.js after compile with v3.250 and 3rd party libs



sasklacz
4 Dec 2012, 5:51 AM
I have a really basic app utilizing ExtScheduler lib. The path to sources is added to sencha.cfg:

app.classpath=${app.dir}/lib/Sch, ${app.dir}/app

and the build/refresh/compile commands work properly, but the all-classes.js file is empty because I had to use incorrect imports to have no errors in the console :



<!-- <x-compile> -->
<!-- <x-bootstrap> -->
<script src="ext/ext-all.js"></script>
<script src="app/app.js"></script>
<!-- </x-bootstrap> -->
<!-- </x-compile> -->


Now if I'll try any other combination, like :



<!-- <x-compile> -->
<script src="ext/ext-all.js"></script>
<script src="app/app.js"></script>
<!-- </x-compile> -->


or



<!-- <x-compile> -->
<!-- <x-bootstrap> -->
<script src="ext/ext-all.js"></script>
<!-- </x-bootstrap> -->
<script src="app/app.js"></script>
<!-- </x-compile> -->


operation crashes with the following error :



[ERR] failed to find meta class definition for name DEMO.controller.EmployeeList


So what is finally the proper way of building app with 3rd party libs ? Is the symbols.js file needed or a different approach is needed ?

dongryphon
4 Dec 2012, 9:32 AM
This form is correct:



<!-- <x-compile> -->

<!-- <x-bootstrap> -->
<script src="ext/ext-all.js"></script>
<!-- </x-bootstrap> -->

<script src="app/app.js"></script>

<!-- </x-compile> -->


The content of the x-compile section minus the content of the x-bootstrap section is what drives the compiler's dependency scan. Without app.js included as above, the compiler would have nothing to scan.

It may be that the classpath does not contain the EmployeeList class.

The default class path is just the "app" folder. If you have not changed the classpath in sencha.cfg, what do you have in the app folder?

sasklacz
4 Dec 2012, 10:48 AM
This is my folder structure :

40569

so this looks properly to me, but the error suggests some module finding problems.

dongryphon
4 Dec 2012, 12:39 PM
What does the EmployeeList.js file look like?

sasklacz
4 Dec 2012, 2:51 PM
The whole force...I mean source :



Ext.define('DEMO.controller.EmployeeList', {
extend : 'Ext.app.Controller',

models : [
'Employee'
],

stores : [
'Employees'
],

views : [
'EmployeeList'
],

init : function() {

this.control({
'EmployeeList button[action=AddEmployee]' : {
click : this.onAddNewResource
},

'EmployeeList' : {
RemoveResource : this.onRemoveResource
}
});
},

onAddNewResource : function() {
var store = this.getEmployeesStore();
store.insert(0, new store.model({
Name : 'New guy',
Salary : 0
}));
},

onRemoveResource : function(grid, rowIndex) {
grid.getStore().removeAt(rowIndex);
}
});

dongryphon
16 Dec 2012, 2:24 PM
I noticed a suspicious space in your classpath:



app.classpath=${app.dir}/lib/Sch, ${app.dir}/app
^


Try removing that (if it is really present in your sencha.cfg)

sasklacz
17 Dec 2012, 4:02 AM
This indeed solved my problem, together with a modified Ext.Loader configuration :



// Ext.Loader.setConfig({
// disableCaching : true,
// enabled:true,
// paths: {
// DEMO:'app'
// }
//});

Ext.Loader.setConfig({
enabled : true
});
Ext.Loader.setPath('Sch', './lib/js/Sch/');