Skip to content

ci: room in the widget budgets for the reply actions and the header menu - #508

Merged
anurag629 merged 1 commit into
devfrom
perf/widget-budget-room
Oct 31, 2026
Merged

anurag629 merged 1 commit into
devfrom
perf/widget-budget-room

Conversation

@anurag629

Copy link
Copy Markdown
Member

The last P2 widget features don't fit in the budgets set in #469. The Stop button (#498) and offline sending (#502) have used up the headroom. Two more are in review:

Feature Panel Single file
dev now 17.56 of 18 kB 19.68 of 20 kB
Copy a reply (#504), once its test-only fallback goes (asked in review) about +0.38 kB about +0.38 kB
Header menu (#505), the menu itself in its own chunk a few hundred bytes once trimmed (asked in review) about +1.5 kB, since the single file inlines every chunk

So this raises the budgets:

  • chat panel 18 to 19 kB
  • single file 20 to 22 kB
  • unminified ESM guard 30 to 32 kB

The loader stays at 5 kB, since that's what every page downloads. The panel only loads when the chat opens. CONTRIBUTING has the new numbers.

The next way to get room back, before raising again: about 17.6 kB of the panel is ours, and some of it repeats what the loader already sent. The panel draws its own launcher, so launcher.css (about 1.1 kB gzipped on its own), the launcher button, the welcome bubble and the theme code all ship twice. Reusing the loader's launcher would be a refactor of the hand-over in src/loader/loader.ts:142, so it's left for its own PR.

How I tested this

pnpm --filter @chatcops/widget build then pnpm size on dev: everything passes under the new limits.

I measured the panel's bytes per source file from a sourcemap build. The biggest are widget.ts at 5.0 kB gzipped, the inlined CSS in shadow.ts at 3.3 kB, and messages.ts at 2.8 kB. Mangling more names (#453) has nothing left to give.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant