Undeclared dependencies to mw.util, mw.notify etc need to be explicitly loaded after the deprecation of wikibits (T122755).
>>! In T122755#3224920, @Nemo_bis wrote:
> mw.util is probably used in a now-broken way in hundreds of gadgets and common.js. Someone please mwgrep the wikis to see the affected ns8 pages at least. Then we can notify the local administrators and hopefully the global interface editors can help as well.
>
> (If we don't get some speed at fixing this breakage, a revert may be in order.)
Even if it is going to be temporarily reverted, I'd expect that we will have to eventually make these undeclared dependencies explicit.
## Suggested fixes
> See [[https://www.mediawiki.org/wiki/Help:Locating_broken_scripts|mw:Help:Locating_broken_scripts]], [[https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript|mw:ResourceLoader/Legacy_JavaScript]] and [[https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)|mw:ResourceLoader/Migration_guide_(users)]] for more.
For Common.js, a typical fix with [[https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Client-side_.28dynamically.29|mw.loader.using]] will look like this:
```lang=js,name=Before
(function() {
...
x = mw.util.getParamValue( 'withJS' ); /* util is used but not loaded */
...
}());
```
```lang=js,name=After
mw.loader.using(['mediawiki.util']).then(function() {
...
x = mw.util.getParamValue( 'withJS' );
...
});
```
For gadgets, typically the right fix is to add necessary [[https://www.mediawiki.org/wiki/Extension:Gadgets#Options|dependencies]] into the `dependencies=` option written in MediaWiki:Gadgets-definition. If you are not sure you can continue maintaining the script, you might want to replace it with a reference to the same (or similar), better-maintained script hosted elsewhere: see https://en.wikipedia.org/wiki/Wikipedia:User_scripts#Full_manual_instructions for how to do that.