Skip to content

build(frontend): strip comments from the production bundle#1572

Merged
danielcopper merged 1 commit into
mainfrom
chore/strip-bundle-comments
Jul 23, 2026
Merged

build(frontend): strip comments from the production bundle#1572
danielcopper merged 1 commit into
mainfrom
chore/strip-bundle-comments

Conversation

@danielcopper

Copy link
Copy Markdown
Owner

The @decky/rollup preset ships an unminified ESM bundle and pipes src/ comments verbatim into dist/index.js via @rollup/plugin-typescript, whose removeComments defaults to false. The plugin's dense doc-comments therefore counted against the 800 kB size-limit 1:1 — a budget taxing comment quality. main sits at ~3.2 kB of headroom, and #1570 has five more PRs queued behind it.

Set removeComments in tsconfig.json so the TypeScript transpile drops comments from the emitted bundle only. Source is untouched; tsc --noEmit (typecheck) and vitest (own transform) are unaffected — only the Rollup build output changes. No functional comments exist in src/ (verified: no @license / @preserve / __PURE__ / webpack magic), so nothing load-bearing is lost.

Bundle: 799.74 kB → 512.01 kB — ~290 kB was comment text. Headroom goes from ~260 B to ~288 kB.

mise run gate green: build, typecheck, pnpm size (512 kB under the 800 kB limit), 2132 frontend + 6260 backend tests, all check_* gates.

docs: N/A — build tooling only, no user-visible change and no architecture shift.

The @decky/rollup preset ships an unminified ESM bundle and pipes src/
comments verbatim into dist/index.js via @rollup/plugin-typescript, whose
removeComments defaults to false. The plugin's dense doc-comments therefore
counted against the 800 kB size-limit 1:1 — a budget taxing comment quality,
with main sitting at 3.2 kB of headroom.

Set removeComments in tsconfig so the TypeScript transpile drops comments from
the emitted bundle only. Source is untouched; typecheck (--noEmit) and vitest
(own transform) are unaffected. No functional comments exist in src/ (no
@license / @preserve / __PURE__ / webpack magic), so nothing load-bearing is
lost. Bundle: 799.74 kB -> 512.01 kB.
@sonarqubecloud

Copy link
Copy Markdown

@danielcopper
danielcopper merged commit 3b403ac into main Jul 23, 2026
16 checks passed
@danielcopper
danielcopper deleted the chore/strip-bundle-comments branch July 23, 2026 19:41
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