Repository navigation
fix(publisher): minify published runtime script bundles - #649
Draft
invisibletype wants to merge 1 commit into
Draft
invisibletype wants to merge 1 commit into
invisibletype wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tspassesminify: input.target === 'publish'toesbuild.build. That target already switches on chunk splitting and drops source maps, so minification follows the same split. The new test inserver/__tests__/runtime-bundle-scripts.test.tsbuilds 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.0from the Dependencies panel. The unminified bundle matched the published entry byte for byte, about 170 kB.Verification
bun run build: passesbun test: the runtime bundle suites pass (runtime-bundle-scripts,siteRuntimeBuild). The full run on Windows has failures unrelated to this diff:serverArtifactPluginsENOENT, because the compiled test binaries are never produced on this machinebun run lint: passesChecklist
🤖 Generated with Claude Code