Page MenuHomePhabricator

MW 1.28-alpha reports "[resourceloader] Unexpected general module ..." and now?
Closed, InvalidPublic

Description

To my surprise MW 1.28-alpha suddenly reports:

[resourceloader] Unexpected general module "ext.smw.style" in styles queue.
[resourceloader] Unexpected general module "ext.smw.tooltip.styles" in styles queue.

These modules have been defined for along time (meaning since MW 1.19) such as:

'ext.smw.style' => $moduleTemplate + array(
	'styles' => array(
		'smw/ext.smw.css'
	),
	'dependencies' => array(
		'ext.smw.tooltip.styles'
	),
	'position' => 'top',
	'targets' => array( 'mobile', 'desktop' )
),
$this->outputPage->addModuleStyles(
	array(
		'ext.smw.style'
	)
);

MediaWiki 1.28.0-alpha (420fb1e)
PHP 5.6.8 (apache2handler)
MySQL 5.6.24
ICU 54.1

What is this suppose to mean? Why does this happen? Do we actually have to care for this?

Event Timeline

@mwjames The relevant code lives in FileModule::getType and makeResourceLoaderLink(), it relates to:

The main purpose of this warning is to inform you that you should not load part of a module but rather always load it in its entirety or split up modules as needed. Specifically for cases where a module contains both scripts and styles, and you're loading only the styles.

The reason being that that way we can finally maintain loader state in JavaScript of style modules to avoid duplicate loading of styles that are sometimes preloaded, and sometimes not (e.g. a JavaScript module that uses OOjs UI, that can be used on a page that already uses OOUI styles, but also on pages that don't).

Your module is seen as a general module instead of a style module because it has dependencies, which have never been supported on style modules. Things probably work fine for you because it either doesn't really depend on it, or because you're already loading that module.

Removing the dependencies property should fix the warning.

Krinkle moved this task from Inbox to Backlog on the MediaWiki-ResourceLoader board.