I'm curious if we're open to using webpack in the Popups extension. While reviewing https://gerrit.wikimedia.org/r/#/c/333320/2 I felt that it's a shame we use mw.popup in so many places and now have so many JS files listed in a ResourceLoader module. Using webpack would make development much easier and nicer.
It also seems like it may help with our use of Mustache templates - we could compile these rather than pull in the Mustache library and the templates (note currently Wikipedia doesn't load Mustache on pageload which would happen once Popups goes live).
Benefits:
- Reduce need for mw.popup global
- require files rather than rely on RL
- expected optimisations to size of code
- Fix T147306
Cons
- adds a compilation phase:
== Suggested switchover strategy
[x] Create folder build_resources with folder ext.popups
[x] Generate ext.popups/reducers using bundler generated from build_resources that assumes mw.popups global and assigns to mw.popups.reducers (ext.popups script RL definition should now be one file for reducers.js)
[x] Generate changeListeners using bundler generated from build_resources that assumes mw.popups global and assigns to mw.popups.changeListeners (ext.popups script RL definition should now be one file for changeListeners.js)
[x] Generate preview and top level JS so that it is bundled from build_resources (ext.popups RL script definition should now be one file)
[] Add developer documentation
[] Add CI check so that built assets have to be up to date
[] Migrate templates
[] Migrate QUnit unit browser tests to run in qunit node with common JS and remove the exposed keys on the global object