Extension:Popups and Extension:MobileFrontend currently uses webpack to build its JS assets.
At some point we will need to reconsider this with 2 options
- Use whatever build step becomes the official build step (e.g. rollup)
- Switch to packageFiles in ResourceLoader
Switch to packageFiles in ResourceLoader
Steps required:
- Switch imports to requires - Semi-manual. Can use https://marketplace.visualstudio.com/items?itemName=tlevesque.import-to-require
and run eslint
- Replace SVG import with JS module exporting SVG
- Make build script for populating extension.json
Pros:
- For many changes no build step is required
- Works without npm install
- More consistent with how other repos do things
- It works
- No minified code in the repo
Cons:
- lose hot reloading
- added developer friction - new files now need to be added to extension.json every time they are created.
- must manually verify Redux and Redux Thunk are trusted - can't load from npm (but some may see this as an advantagE) - these would need to make use of foreign-resources.
- Increases bytes shipped from 16.55kb => 18.08kb - dead code elimination and optimization becomes a manual process
- restricted to writing older JS code using requires (e.g. https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/1003805 not possible)