Lesson 4.2

Bundle analysis

A treemap of the built output turns the bundle from an abstraction into a picture, and the picture is usually surprising: a date library with every locale, two versions of the…

3mAdvanced4.6k students

Overview

Open the bundle before you guess at it

A treemap of the built output turns the bundle from an abstraction into a picture, and the picture is usually surprising: a date library with every locale, two versions of the same package, an icon set imported in full for three icons.

Duplicates come from version mismatches between transitive dependencies. Deduplicating them is often the single largest win available and requires no code change at all.

For anything large, check whether it supports importing only what you use before you accept its full weight.

In this lesson you will:

  • Find out what is actually in your bundle
  • Spot duplicated and oversized dependencies
  • Replace a heavy library with a lighter path

Resources

Previous Lesson
Next Lesson
Bundle analysis — React Performance Engineering — Vertex