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'
])
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'
])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.