Bundle audit: remove dead WASM deps, add analyzer, document composition#129
Conversation
… tooling - replicad + replicad-opencascadejs had zero imports left after the micro-app migrations; removing them slims installs/CI by ~15 MB - The asyncWebAssembly/node-mock webpack config existed only for them - ANALYZE=1 npm run build now writes build/bundle-report.html - dev-plans/bundle-audit-2026-07.md documents the full audit: 642 KB first-load on every page (framework only), all heavy libraries (rapier+three 3 MB, mdx 743 KB, jspdf 391 KB, emoji picker 262 KB, locale dictionaries) verified lazy Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request removes the dead dependencies replicad and replicad-opencascadejs along with their WebAssembly webpack configuration, and integrates webpack-bundle-analyzer to measure bundle sizes. Feedback on the changes suggests refining the ANALYZE environment variable check to prevent false positives and correcting the analyzer's output path to prevent the generated report from polluting the project root.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // every WASM consumer now runs as a standalone utility app. | ||
| const analyzerPlugins = | ||
| process.env.ANALYZE && !isServer | ||
| ? [ | ||
| new BundleAnalyzerPlugin({ | ||
| analyzerMode: 'static', | ||
| reportFilename: '../bundle-report.html', | ||
| openAnalyzer: false, | ||
| }), | ||
| ] |
There was a problem hiding this comment.
There are two issues with the current webpack bundle analyzer configuration:
- Environment Variable Check:
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'. - Report Filename Path: Docusaurus sets the webpack
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.
| // every WASM consumer now runs as a standalone utility app. | |
| const analyzerPlugins = | |
| process.env.ANALYZE && !isServer | |
| ? [ | |
| new BundleAnalyzerPlugin({ | |
| analyzerMode: 'static', | |
| reportFilename: '../bundle-report.html', | |
| openAnalyzer: false, | |
| }), | |
| ] | |
| const analyzerPlugins = | |
| (process.env.ANALYZE === 'true' || process.env.ANALYZE === '1') && !isServer | |
| ? [ | |
| new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)({ | |
| analyzerMode: 'static', | |
| reportFilename: 'bundle-report.html', | |
| openAnalyzer: false, | |
| }), | |
| ] | |
| : []; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ce94f9018
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const analyzerPlugins = | ||
| process.env.ANALYZE && !isServer | ||
| ? [ | ||
| new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)({ |
There was a problem hiding this comment.
Replace analyzer require to keep lint passing
When the root config is linted, this new require() makes the project's lint gate fail: pnpm exec eslint docusaurus.config.ts reports @typescript-eslint/no-require-imports here, and package.json's lint script includes *.ts. Any CI or pre-commit step running pnpm lint will now fail until this is changed to an import or the config is explicitly exempted.
Useful? React with 👍 / 👎.
Closes #99
Audit verdict
The micro-app migrations already did the heavy lifting: every page's critical path is 642 KB total (
main633 KB + runtime 9 KB), containing only framework pieces — react-dom, Docusaurus theme, prism highlighting, lunr offline search, and theendictionary. No WASM, 3D, PDF, or editor library ships on the landing/docs render path.All heavy libraries verified lazy, loading only where used:
enis eager)Supabase stays out of
mainthanks to the existing lazy client facade.Changes
replicad+replicad-opencascadejs— zero imports left insrc/(verified); ~15 MB lighter installs/CI (the OpenCascade WASM alone is ~11 MB in node_modules)asyncWebAssembly,__filenamemocks,fs/path/cryptofallbacks) — clean production build confirms nothing needed itANALYZE=1 npm run buildnow emitsbuild/bundle-report.htmlfor one-liner future auditsdev-plans/bundle-audit-2026-07.md— full findings and the 642 KB baseline to hold against regressionsVerification
pnpm typecheck,pnpm lint, fullpnpm build— all green without the removed deps/config🤖 Generated with Claude Code