I'm about to create an extension forMediaWiki in which I want to provide a special page that shows a form. For this form I want to use Bootstrap including jquery and popper.js. Therefore I need to include js files in the Extension.
Usually the style and script files are included in the extension.json
like this:
"ResourceModules": {
"ext.meForm.custom": {
"position": "top",
"scripts": [
"jquery-3.3.1.slim.min.js",
"popper.min.js",
"bootstrap.min.js",
"ext.meForm.custom.js"
],
"styles": [
"bootstrap.min.css",
"icons.css",
"ext.meForm.custom.css"
]
}
},
And then they need to be loaded in the special page execution
method like this:
$output->addModuleScripts('ext.meForm.custom');
$output->addModuleStyles('ext.meForm.custom');
When I only include the style files (just remove the scripts
property), then the styles are applied as expected. But when I add the script
property, not just the scripts aren't applied, but also the styles aren't applied anymore. Seems like I am doing anything wrong in the module definition, but I don't have any idea what.
Does anyone have any clues or ideas?
Greets, Jakob
Edit:
I forgot to mention, that it seems like it has nothing to do with the js files of jquery, popper or bootstrap, because it behaves the same when I include only the ext.meForm.custom.js
, which is in fact just an empty js file.
The only console output I get is SyntaxError: expected expression, got '<'
from the load.php
at line 1.
I am using Mediawiki version 1.30.1.
Edit: It works now. It seems like the problem was another extension that had an error while loading. I don't really know how this would cause my extension not to load the modules properly but it did.
It works now!
It seems like the problem was another extension that had an error while loading. I don't really know how this would cause my extension not to load the modules properly but it did.