Modern JS toolchains like
webpack optimize for ease of adding third-party libraries over keeping bundle size (and page bloat) small.
For example, using
aws-sdk by default you end up including the entire library which is a few MB. There are numerous bugs in trying to import parts of the library despite claims of modularity. I needed to find the right tsconfig setting to import it in a certain way, then hack around a bug with importing the Lambda client which involved changing the Webpack configuration to resolve the
util module. The default is bloat and requires large effort to reduce bundle size making it unlikely people will do it (convenience is king).
Links to this note
My dad used to tell me about an old car he used to have—the Chevrolet Chevette. It was an inexpensive compact car with rear wheel drive from the late 70s. As he described it, “all the thrills of high-speed driving at low speeds”.
Adding new dependencies to a codebase is a net positive until it’s not. The added leverage of picking up an off-the-shelf solution eventually gives way to dependency hell—fixing breaking changes, incompatibilities between things, security issues, and so on.