Maxym Maxym - 4 months ago 31
Javascript Question

ExtJS 5 requests file with empty name /.js

I've made a fresh workspace with the latest sencha cmd 5.0.2.270 and latest ExtJS 5.0.1. Generated an app into in. Wrote a little bit of code.

I generate production build with sencha app build.

The development loads well, but the production build tries to load file with no name and gets a 404

GET http://yassa-built.dev/.js?_dc=1410352524548 404 (Not Found)
After that error it doesn't load at all.

I can't understand what it is searching for. Development is not complaining at all.

I made an archive with it https://mega.co.nz/#!Dk0gDRJD!dNITsq1fGFs5T4d-4yYFnA6_K6EcAhFkxoeEjaJu7MY (~600kb). It includes the sources and the production build.

UPD
I've found the place where it starts to break. In file RadioAdminController.js.

case 'menu_referals':
return app.setSubView('redmed-radioapp-referals', {
store: Ext.create('RedmedAdmin.store.Referals')
});


If I do not create a store - it works. The production build is ok. The store is nothing special:

Ext.define('RedmedAdmin.store.Referals', {
extend: 'Ext.data.Store',
model: 'RedmedAdmin.model.Referal',
autoLoad: false,
autoSync: true
});

Answer

On the fourth day of struggling a simple answer revealed.

I've missed one dependency. The chain: RedmedAdmin.store.Referals -> RedmedAdmin.model.Referal -> RedmedAdmin.model.redmed.RadioAppBase.

As I provided the archive, I will list class RedmedAdmin.model.redmed.RadioAppBase here (working version):

Ext.define 'RedmedAdmin.model.redmed.RadioAppBase',
    extend: 'Ext.data.Model'
    requires: ['Ext.data.identifier.Uuid', 'Ext.data.proxy.Rest']

    identifier: 'uuid'
    fields: [{
            name: 'id'
            type: 'string'
    }]
    schema:
            namespace: 'RedmedAdmin.model.redmed.radioapp'
            proxy:
                    type: 'rest'
                    url: 'http://10.0.29.140:6543/api/rest/{entityName:lowercase}'
                    reader:
                        type: 'json'
                        rootProperty: '{entityName:lowercase}'
                    listeners:
                        'exception': (request, operation, eOpts ) ->
                            Ext.log {level: 'error'}, "Data request to #{request.url} failed. Reply: #{operation.responseText}"

It defines a schema for all children. The schema uses rest proxy (type: 'rest'). It wasn't included in the broken version. Only Ext.data.identifier.Uuid was listed in requires.

Comments