https://bugzilla.wikimedia.org/show_bug.cgi?id=43905

Krinkle <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Krinkle <[email protected]> ---
(In reply to comment #0)
> In LocalSettings.php:
> 
>  $wgResourceModules['ext.abc'] = array(
>     'loaderScripts' => 'extensions/abc-loader.js',
>  );
> 
> In extensions/abc-loader.js:
> 
>  mw.loader.load("//example.com/js/sample.js");
> 
> In [[MediaWiki:Common.js]]:
> 
>  mw.loader.load( 'ext.abc', function() {
>    console.log("works!");
>  }
> 
> When I load a page, I can see sample.js is loaded, so ext.abc is defined at
> some time.  However the browser's console shows:
> 
>  Error: Unknown dependency: ext.abc

I don't know if you used 'loaderScripts' by accident instead of 'scripts', but
you obviously don't know what 'loaderScripts' is.

loaderScripts are scripts to modify or extend the startup module (the module
registry manifest). By design they aren't a module you can just load (unless
your loader script implements this logic).

In the example you provide, the following is added to the startup module:

( function ( name, version, dependencies, group, source ) {
        mw.loader.load("//example.com/js/sample.js");
    } )("ext.abc", "20130112T184724Z", [], null, "local");

That doesn't make any sense as it ignores all parameters. And this is executed
on every page everywhere unconditionally before ResourceLoader is even fully
initialised.

In the wgResourceModules array, use 'scripts', not 'loaderScripts'. If you did
intentionally use 'loaderScripts' and know what it does, feel free to re-open.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to