I ported some functional widgets from a different wiki running MW 1.31 and Widgets v1.3.1 to mine, which is running MW 1.38 and Widgets v1.4.1. However, some of these ported widgets are not working. In particular, I see errors about mw.hook
and mw.loader.using
not being a function.
I tried to log them in the console as the widget loads, mw
shows up as an object with all the expected properties, but mw.hook
and mw.loader.using
are both undefined.
A simple script to reproduce the issue is as follows:
window.RLQ.push(async () => { console.log(mw); // this shows up as a regular object console.log(mw.loader.using); // this shows up as undefined console.log(mw.hook); // this shows up as undefined });
I typed the names of all these packages in the console after the web page loaded. Everything shows up normally, implying that the widget is perhaps loaded before core mw packages are available.
I feel like I'm missing something very obvious, but I don't know much about javascript and cannot find any migration guides/tutorials that may explain this phenomenon. Everything I saw suggested that mw.hook and mw.loader.using are loaded before everything else and that I don't need to do anything special to use them. Any help is appreciated. Thank you!