-
Notifications
You must be signed in to change notification settings - Fork 0
Bundle audit: remove dead WASM deps, add analyzer, document composition #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Bundle Audit — July 2026 (issue #99) | ||
|
|
||
| Run `ANALYZE=1 npm run build` to regenerate the interactive report at | ||
| `build/bundle-report.html` (webpack-bundle-analyzer, client bundle only). | ||
|
|
||
| ## Headline result | ||
|
|
||
| The micro-app migrations (#93/#94/#95) already achieved the audit's main goal: | ||
| **no WASM, 3D, or document library ships on the critical path.** Every page | ||
| loads the same two files first: | ||
|
|
||
| | File | Parsed size | Contents | | ||
| |---|---|---| | ||
| | `main.<hash>.js` | 633 KB | react-dom (174 KB), prism-react-renderer + prismjs (109 KB), Docusaurus theme/runtime (~140 KB), lunr + language stemmers (71 KB, offline search), mark.js (17 KB), site code incl. the `en` dictionary (33 KB) | | ||
| | `runtime~main.<hash>.js` | 9 KB | webpack runtime | | ||
|
|
||
| Everything in `main` is framework or deliberately-global functionality | ||
| (search, syntax highlighting, theme). There is no obvious low-effort cut left: | ||
| the next meaningful step would be swapping search or highlighting strategies, | ||
| which trades UX for bytes. | ||
|
|
||
| ## Heavy libraries — all verified lazy | ||
|
|
||
| | Chunk | Size | Contents | Loaded on | | ||
| |---|---|---|---| | ||
| | `7084.*` | 3.0 MB | rapier physics (2.2 MB) + three.js (698 KB) + react-three-fiber | Eco Sort game page only | | ||
| | `5741.*` | 743 KB | @mdx-js/mdx compiler + acorn + framer-motion | MDX post editor only | | ||
| | `3512.*` | 391 KB | jspdf | PDF-export tools only | | ||
| | `5527.*` | 262 KB | emoji-picker-react | comment editor interaction | | ||
| | locale chunks | ~15 KB each | `ru/ua/de/es/et` dictionaries | on language switch (only `en` is in `main`) | | ||
|
|
||
| Supabase is dynamically imported by the lazy client facade | ||
| (`src/lib/supabaseClient.ts`) and does not appear in `main`. | ||
|
|
||
| ## Changes made in this audit | ||
|
|
||
| 1. **Removed dead dependencies `replicad` and `replicad-opencascadejs`** — | ||
| zero imports remained in `src/` after the CAD tools moved to standalone | ||
| apps. Shrinks installs/CI by ~15 MB (the OpenCascade WASM binary alone is | ||
| ~11 MB in node_modules); runtime bundles were never affected because | ||
| webpack only bundles imported modules. | ||
| 2. **Removed the replicad WASM webpack config** (`asyncWebAssembly`, | ||
| `__filename` mocks, `fs/path/crypto` fallbacks) — nothing in the site | ||
| bundle imports WASM anymore. Verified by a clean production build. | ||
| 3. **Committed the analyzer tooling** (`ANALYZE=1` flag in the webpack | ||
| plugin) so future audits are a one-liner. | ||
|
|
||
| ## Acceptance criteria mapping | ||
|
|
||
| - *Bundle analysis report committed or documented* — this file + reproducible | ||
| `ANALYZE=1` build. | ||
| - *No WASM/3D library loaded on the landing or docs pages* — verified: the | ||
| only render-path JS is `main` + `runtime` (table above); three/rapier live | ||
| exclusively in the Eco Sort chunk. | ||
| - *Measurable reduction in first-load JS for non-tool pages* — the big | ||
| reduction was delivered by the migrations this audit verified (the last | ||
| in-bundle CAD tool previously pulled replicad/OpenCascade context into | ||
| shared chunks); this pass removes the leftover dependency and config debt | ||
| and establishes the measurement baseline (642 KB total first-load) to hold | ||
| the line against regressions. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two issues with the current webpack bundle analyzer configuration:
process.env.ANALYZEis a string. If a user runs the build withANALYZE=falseorANALYZE=0, it will still evaluate to truthy in JavaScript, causing the analyzer to run unexpectedly. It is safer to explicitly check for'true'or'1'.output.pathto thebuilddirectory. Using../bundle-report.htmlwill write the report to the project root (one level abovebuild), polluting the repository. Changing it to'bundle-report.html'ensures it is written inside thebuilddirectory as documented indev-plans/bundle-audit-2026-07.md.