Knowledgebase

Optimising the Build Output Print

  • frontenddevelopment, frontend, performance, caching, guide, howto, solution, zillionkinghost
  • 0

Shipping less.

WHAT TO MEASURE FIRST

Total output size, and what the largest contributors are.

HOW

Bundle analysis tooling.

WHAT TO DO ABOUT LARGE DEPENDENCIES

Establish whether you use enough of them to justify their size Import only what you need, where the library supports it Find a smaller alternative Remove it

WHAT TREE SHAKING DOES

Removes code that is never used.

WHAT PREVENTS IT WORKING

Libraries not published as modules Imports of an entire library rather than specific parts Side effects preventing safe removal

WHAT CODE SPLITTING PROVIDES

Only loading what a route needs.

WHAT TO SPLIT

By route, always Large components used rarely Heavy dependencies used in one place

WHAT TO DEFER

Anything not required for the initial view.

WHAT TO SET FOR ASSETS

Long cache durations, with versioned filenames.

WHAT TO ENABLE

Compression, on the server.

WHAT TO CHECK AFTER EVERY CHANGE

Whether the bundle grew.

WHAT TO AUTOMATE

A size limit, failing the build when exceeded.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot