ResourceLoader modules are defined inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/wikimedia/mediawiki/llms.txt
Use this file to discover all available pages before exploring further.
extension.json under the ResourceModules key. Each module is a named object that declares its scripts, styles, dependencies, messages, and other properties. ResourceLoader reads these definitions and serves the module content via load.php.
A complete module definition
Module properties
scripts and styles
scripts lists JavaScript files to include. styles lists CSS or LESS files.
localBasePath (which defaults to the extension root when using remoteExtPath).
packageFiles
packageFiles bundles JavaScript files into a CommonJS-style package where each file can use require() to import other files in the same module. This is the preferred approach for complex modules:
"main": true) is the entry point. Core uses this pattern extensively:
packageFiles entries can also be objects with a callback for dynamic content:
dependencies
dependencies lists other module names that must be loaded before this module:
CircularDependencyError.
messages
messages lists i18n message keys that the module needs. The messages are loaded alongside the JavaScript and are accessible via mw.msg():
templates
templates maps template names to file paths. Templates are loaded as strings accessible via mw.templates:
skinStyles
skinStyles provides skin-specific CSS overrides. Use "default" to apply to all skins, or a skin name for targeted overrides:
targets
targets controls which platforms a module is delivered to:
["desktop"]. To include a module on MobileFrontend-powered mobile pages, add "mobile".
Module types
Standard file modules
The default module type. Uses theFileModule class internally. Supports scripts, styles, packageFiles, dependencies, messages, templates, skinStyles, and targets.
Package modules
Modules usingpackageFiles are “package modules” — they bundle multiple JavaScript files into a single scope where files can require() each other. This avoids polluting the global scope.
Startup module
The startup module (mediawiki.loader) is a special module managed by StartUpModule. It is the first module loaded on every page and bootstraps the entire ResourceLoader client. It registers all other module names, version hashes, and dependency graphs in a compact encoding.
The startup module has reserved group IDs for certain module groups:
Core module groups
jQuery modules
| Module | Description |
|---|---|
jquery | jQuery core library |
jquery.client | Browser detection utilities |
jquery.confirmable | Inline confirm/cancel prompts |
jquery.makeCollapsible | Collapsible sections |
jquery.tablesorter | Sortable table support |
jquery.chosen | Select enhancement |
mediawiki.* core modules
| Module | Description |
|---|---|
mediawiki.base | mw global, mw.config, mw.message |
mediawiki.api | Action API client (mw.Api) |
mediawiki.util | Utility functions (mw.util) |
mediawiki.notification | Notification system (mw.notification) |
mediawiki.Title | Title parsing and normalization |
mediawiki.Uri | URL parsing |
mediawiki.storage | localStorage wrapper |
mediawiki.cookie | Cookie utilities |
mediawiki.jqueryMsg | Advanced message parser |
mediawiki.router | Client-side routing |
mediawiki.experiments | A/B testing |
Site and user modules
site module loads MediaWiki:Common.js. The user module loads the active user’s User:Name/common.js. These modules belong to the site and user groups respectively and are loaded on every page.
Polyfills
Core includes a polyfill bundle for browsers that do not support modern web APIs:skipFunction is evaluated client-side. If it returns true, the polyfill is skipped entirely, avoiding unnecessary download for modern browsers.