Hi,
Preface: I understand very little about how ResourceLoader works.
I was trying to use the mw.Api module to do some API calls, following the general example of the documentation:
var api = new mw.Api();
api.get( {
action: 'query',
meta: 'userinfo'
} ).done ( function ( data ) {
console.log( data );
} );
However, I was getting an error in the JS console:
TypeError: undefined is not a constructor (evaluating 'new mw.Api()')
For our dev server and on my local instance of MediaWiki (on a Mac), $wgResourceLoaderDebug is set to
true so we can debug our individual JS files. For kicks, I set this value to
false in my page URL (e.g. "
http://mywiki/index.php/MyPage?
debug=false"), allowing ResourceLoader to do its magic - the error went away, giving me the data I wanted. When I flipped it back to
true, the error returned.
Is this known behavior, a bug? Or could I have some other strange configuration which is causing this problem?