Vonage / vivid-3

Vonage's web UI 🎨 toolbelt
https://vivid.deno.dev
Apache License 2.0
54 stars 11 forks source link

feat(components): support tree shaking (VIV-1672) #1875

Closed RichardHelm closed 2 months ago

RichardHelm commented 2 months ago

Adds sideEffects property to package.json which allows bundlers to tree-shake unused components. Example bundle with just button being used goes from 1.35 MiB to 95 KiB.

Vivid component code is itself is considered by bundlers to have side-effects, which is why it is not tree-shakable out of the box. This property allows bundlers to skip going into the component files in the first place, so they don't get included anymore.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (d61b119) to head (a17f54b). Report is 1048 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1875 +/- ## =========================================== Coverage 100.00% 100.00% =========================================== Files 123 341 +218 Lines 1562 6209 +4647 Branches 108 781 +673 =========================================== + Hits 1562 6209 +4647 ``` | [Flag](https://app.codecov.io/gh/Vonage/vivid-3/pull/1875/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/Vonage/vivid-3/pull/1875/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage) | `100.00% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.