Knowledgebase

Understanding Webpack Print

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

The established bundler.

WHAT IT DOES

Builds a dependency graph from an entry point, and produces bundles.

WHAT LOADERS DO

Transform files: compile, process stylesheets, handle assets.

WHAT PLUGINS DO

Act on the whole build: generate markup, extract stylesheets, analyse output.

WHY IT IS STILL PRESENT

Enormous numbers of existing projects use it, and it handles complex requirements.

WHAT IT COSTS

Configuration complexity Slower builds on large projects

WHAT TO UNDERSTAND IN ANY CONFIGURATION

Entry points Output configuration Loaders, and the order they apply Plugins Resolution and aliases Mode, which changes optimisation

WHY LOADER ORDER MATTERS

They apply in reverse of how they are listed, which confuses everyone once.

WHAT CODE SPLITTING PROVIDES

Separate bundles loaded on demand, rather than one large file.

WHAT TO SPLIT BY

Route, and large dependencies.

WHAT TO ANALYSE

Bundle contents, which reveals what is actually included.

WHAT YOU WILL FIND

Large dependencies included for one function.

WHAT TO DECIDE FOR NEW PROJECTS

Whether a simpler tool would suffice.


Was this answer helpful?
Back

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


Trustpilot