Reduce static site bundle size by 86% via Preact migration#16
Draft
Claude wants to merge 4 commits into
Draft
Conversation
Co-authored-by: VoX <289464+VoX@users.noreply.github.com>
- Replace React with Preact for smaller bundle size - Update all React imports to use Preact hooks - Configure Vite with terser minification - Add console dropping and other optimizations - Result: Main bundle reduced from 209.18 kB to 28.55 kB (86% reduction) - Gzipped size reduced from 66.16 kB to 11.09 kB (83% reduction) Co-authored-by: VoX <289464+VoX@users.noreply.github.com>
- Enable CSS minification - Add more aggressive terser compression (2 passes) - Remove console.info and console.debug calls - Enable Safari 10 mangle compatibility - Worker bundle reduced from 42.25 kB to 42.15 kB Co-authored-by: VoX <289464+VoX@users.noreply.github.com>
Collaborator
|
sick |
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.
Migrated from React to Preact and added aggressive build optimizations to reduce static site bundle size.
Changes
Framework swap: React 19.2.0 → Preact 10.28.3
preact/hooksmain.tsxReact.*Eventto native DOM typesjsxImportSource: "preact"Build optimizations: Configured Terser with aggressive settings
log,info,debug)Results
Total gzipped payload reduced from ~75 kB to ~13 kB.
Original prompt