Christoph Nakazawa, former Engineering Management at Facebook and now Front End Engineer at Stripe, is writing a series about JavaScript infrastructure. In this second part of this still in progress series he digs into eliminating the ongoing need for installing dependencies from the development iteration cycle.
I provide recommendations that I personally implemented and have seen work in a large monorepo with hundreds of thousands of files at Facebook. The ideas are high impact but also high effort. Let me take you on a journey of what reimagining JavaScript infrastructure could look like. My solution — check all of our dependencies into source control and make all development tools available as pre-compiled binaries. This would speed up all repository operations (getting everything up-to-date after a rebase) as well as reduce our in-band reliance on dependency management tools.
Having implemented such a strategy at Facebook, the effects were remarkable:
Immediately after checking out a gigantic monorepo, the time it took to install dependencies, start Metro and build JavaScript bundles was reduced from seven minutes to seven seconds. Half of the improvements came from ideas presented in this series so far, and the other half was achieved through bundling optimizations we’ll talk about in the future. Stay tuned!
The proposed improvements can easily be applied to other programming languages too.