**Motivation**
Our "dependency management" (more accurately, requiring js files/modules within other ones) of javascript files/modules are being currently handled through the Resource Loader.
Allegedly, Resource Loader dependency management feature was not design to also host this kind of use-case.
Using javascripts's require/import solution is more appropriate for that use-case. Using a packing solution on top of that is also appropriate to reduce the amount of http traffic overhead if we load these files asynchronously (which is still not supported by all browsers to this date https://caniuse.com/#feat=es6-module-dynamic-import) as well as
**Problem**
As of 7 May 2018 in production, Wikibase's 248 RL modules result in 14,453 bytes (5,210 bytes after gzip) being shipped on every page view of every Wikipedia for every reader. That's 6.4TiB a day of extra load on readers.
**Suggested Solution**
Use Webpack to bundle our javascript modules in single files. Webpack is chosen for the following reasons:
- it is quite mature build and packing tool in javascript ecosystem
- it brings modern tooling and features from javascript ecosystem into our stack through easy integration with Babel
- it has been already done and used in our production for MobileFrontend skin {T195475} {T207787} {T194098}
**Impact**
- On performance: not clear yet
- On dev productivity: can be big, allowing us to use modern javascript through Babel
**Estimated Trailblazing length**
couple of weeks (2-3 weeks for 100-150% FTE)