Performance in Jira front-end: solving bundle duplicates with Webpack and yarn
Dec 23, 2020Alexey Shpakov

Summary
This post introduces a custom Webpack plugin designed to deduplicate transitive dependencies. It explains the concepts of direct vs. transitive dependencies, duplicated dependencies, and the semver deduplication process. The core contribution is the technical implementation of a `NormalModuleReplacementPlugin` to identify and replace duplicated nested dependencies with a single canonical version, thereby reducing the final bundled JavaScript size. The post also details the challenges with non-semver compatible dependencies and how Webpack's resolution algorithm can lead to further duplication.