Skip to content

fix(publisher): minify published runtime script bundles - #649

Draft
invisibletype wants to merge 1 commit into
CoreBunch:mainfrom
invisibletype:fix/minify-published-runtime-scripts
Draft

invisibletype wants to merge 1 commit into
CoreBunch:mainfrom
invisibletype:fix/minify-published-runtime-scripts

Conversation

@invisibletype

Copy link
Copy Markdown

Requested by Arlo

Summary

Before: published site scripts were bundled by esbuild without minification. A script that only imports GSAP published as a 170 kB entry file (44 kB gzipped), with comments and full identifiers.

After: publish builds are minified, and the same script ships at 71 kB (28 kB gzipped). Canvas builds are unchanged and stay readable for their inline source maps. Classic scripts are still emitted byte-for-byte.

How: server/publish/runtime/bundleScripts.ts passes minify: input.target === 'publish' to esbuild.build. That target already switches on chunk splitting and drops source maps, so minification follows the same split. The new test in server/__tests__/runtime-bundle-scripts.test.ts builds one module script for both targets: the publish output is minified and the canvas output keeps its identifiers.

Sizes were measured on a local site with gsap@3.15.0 from the Dependencies panel. The unminified bundle matched the published entry byte for byte, about 170 kB.

Verification

  • bun run build: passes
  • bun test: the runtime bundle suites pass (runtime-bundle-scripts, siteRuntimeBuild). The full run on Windows has failures unrelated to this diff:
    • symlink EPERM
    • serverArtifactPlugins ENOENT, because the compiled test binaries are never produced on this machine
    • architecture gates and two admin UI tests on files outside this change
  • bun run lint: passes
  • Docker/deployment check, if relevant (not run)

Checklist

  • Tests cover behavior changes.
  • Docs were updated when behavior, config, deployment, or public surfaces changed. No doc describes bundle minification.
  • No compatibility shim was added for old pre-release behavior.
  • No secrets, local databases, uploads, or generated artifacts are included.

🤖 Generated with Claude Code

Published module bundles carry their npm dependencies, and esbuild ran
without minify, so GSAP alone shipped at ~170 kB. Publish builds are now
minified (GSAP: 170 kB to 71 kB, 28 kB gzipped). Canvas builds stay
unminified for their inline source maps; classic scripts are still emitted
byte-for-byte.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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