0

Can you tell me why I am getting this error?

Uncaught TypeError: Ext.Loader.require.setConfig is not a function

I am trying to replace Loader with require, so I am getting the error. Can you guys tell me how to fix it?

Providing my code below:

var scripts = document.getElementsByTagName('script');
var sportsAllExt4Path = undefined;
for(var idx in scripts){    
    if(scripts[idx].src !== "" && scripts[idx].src !== undefined){      
        var path = scripts[idx].src.split('?')[0];  
        var fileName = path.split('/').slice(-1).join().split('.')[0]; 
        if(fileName === "sportsAll-dev"){
            sportsAllExt4Path = path.split('/').slice(0, -1).join('/');
            break;
        }
    }
}

Ext.Loader.require.setConfig({enabled:true});
Ext.Loader.setPath('sportsAll.plugin', sportsAllExt4Path.replace('/scripts/sportsAll-extjs4', '/js/sportsAll/plugin'));
Ext.Loader.setPath('sportsAll', sportsAllExt4Path + '/sportsAll');
Ext.syncRequire([
      'sportsAll.Base'
])
Racil Hilan
  • 24,690
  • 13
  • 50
  • 55

1 Answers1

1

Use just

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

Yes, just remove require from your code

var scripts = document.getElementsByTagName('script');
var sportsAllExt4Path = undefined;
for(var idx in scripts){    
    if(scripts[idx].src !== "" && scripts[idx].src !== undefined){      
        var path = scripts[idx].src.split('?')[0];  
        var fileName = path.split('/').slice(-1).join().split('.')[0]; 
        if(fileName === "sportsAll-dev"){
            sportsAllExt4Path = path.split('/').slice(0, -1).join('/');
            break;
        }
    }
}

Ext.Loader.setConfig({enabled:true});
Ext.Loader.setPath('sportsAll.plugin', sportsAllExt4Path.replace('/scripts/sportsAll-extjs4', '/js/sportsAll/plugin'));
Ext.Loader.setPath('sportsAll', sportsAllExt4Path + '/sportsAll');
Ext.syncRequire([
      'sportsAll.Base'
])
olegtaranenko
  • 3,722
  • 3
  • 26
  • 33
  • thanks for your reply, but I want to replace loader with require due to the following reason http://stackoverflow.com/questions/28524757/extjs-4-2-possible-causes-of-a-sychronous-xmlhttprequest-warning –  Sep 08 '15 at 17:52