π Production
How Parcel helps you optimizing your project for production
See Scope hoisting for how to optimize your code for tree shaking.
ΒΆ Inspecting bundle size
Parcel has builtin plugins for a few tools to help with analyzing bundle size.
ΒΆ Bundle Analyzer
To generate a HTML file for every bundle, run the @parcel/reporter-bundle-analyzer
plugin (eith with the --reporter
flag or via "reporters"
in .parcelrc):
parcel build src/index.html --reporter @parcel/reporter-bundle-analyzer
This generates a folder parcel-bundle-reports
in your project root with an HTML file for every target:
ΒΆ Bundle Buddy
parcel build src/index.html --reporter @parcel/reporter-bundle-buddy
Upload the files in the dist directory on the Bundle Buddy website.