fix: cut initial JS bundle 1 466 kB → 487 kB (−67%) — remove dead packages, lazy-load ExcelJS, split vendors#69
Merged
Merged
Conversation
- Remove 10 unused packages: @radix-ui/* (6 pkgs, fully replaced by @base-ui), zustand, react-day-picker, @krakz999/tabula-node, tauri-plugin-pldownloader-api, and rollup-plugin-visualizer - Delete calendar.tsx (only consumer of the removed react-day-picker) - Lazy-load XlsxService/ExcelJS via dynamic import() in exportService.ts — ExcelJS (~700 kB raw) is now deferred to a separate xlsxService chunk that is only fetched when the user first exports to XLSX - Inline ExportService.getFileName() so the static XlsxService import is fully eliminated from the initial module graph - Add vite manualChunks to split react, @base-ui, and lucide-react into separately cacheable vendor chunks; raise chunkSizeWarningLimit to 1 100 kB to acknowledge the intentionally lazy ExcelJS chunk
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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.
Problem
The entire app — including ExcelJS (~700 kB) — was bundled into a single 1 466 kB chunk loaded on every cold start, even when the user exports to CSV and never touches XLSX.
Changes
Dead-package removal
10 packages removed from
package.json:@radix-ui/react-checkbox@base-ui/react@radix-ui/react-label@base-ui/react@radix-ui/react-scroll-area@base-ui/react@radix-ui/react-select@base-ui/react@radix-ui/react-slot@base-ui/react@radix-ui/react-tooltip@base-ui/reactzustandreact-day-pickercalendar.tsxscaffold@krakz999/tabula-nodetauri-plugin-pldownloader-apirollup-plugin-visualizer(dev) also removed (was added temporarily for analysis).ExcelJS code-split (
src/services/exportService.ts)import { XlsxService }— this was the root cause dragging ExcelJS into every page loadcreateDownloadLinkandgetFileBuffernow useawait import("./xlsxService")for the XLSX branch onlygetFileNameinlined so no import is needed at all for the common metadata pathVendor chunk splitting (
vite.config.ts)react+react-dom→vendor-react(separately cacheable)@base-ui/react→vendor-base-uilucide-react→vendor-lucidechunkSizeWarningLimit: 1100to acknowledge the intentionally large lazy ExcelJS chunkDeleted files
src/components/ui/calendar.tsx— only consumer ofreact-day-pickerBefore / After
The
xlsxServicechunk (975 kB / 279 kB gzip) is loaded on demand and then browser-cached.Test plan
pnpm buildcompletes with no errors or unexpected warningspnpm auditstill shows no known vulnerabilities