Blocked on: T158980
After having experimented with using a bundler in Page previews, We will use webpack to generate MobileFrontend's mobile.startup module.
This will
- reduce size of RL module
- Avoid unnecessary file loading in ResourceLoader
- Make it easier for us to port to a submodule in future if necessary
- Remove the need for unnecessary globals
- Use npm libraries
- Allow us to experiment/investigate using Es5/6, template compiling
- Prevent us from surfacing functions purely for testing purposes e.g. in Skin.js we expose getSectionId;
acceptance criteria
- Use webpack to generate a single JS file that is included by mobile.startup that includes all the existing JavaScript
- Templates and LESS files will continue to be loaded via ResourceLoader
- Use exports/imports where possible for exporting/importing rather than M.define/M.require
- There is fast isolated unit testing with npm run test:unit e.g. https://gerrit.wikimedia.org/r/#/c/282899/
- Integrate code coverage reports and fail job on coverage decrease
- The closures around every file should be unnecessary after these changes (RL wraps code so no global var leakages, and eslint protects against unused/undefined variables used)
e.g. we can remove the following pattern
( function ( M, $ ) {