Skip to content

Split the bundle so heavy visualisation and editor dependencies load on demand #22

Description

@priscaenoch

Problem

The app depends on several very large libraries: monaco-editor, 3d-force-graph, cytoscape, react-flow-renderer, @webcontainer/api, and jszip. vite.config.ts sets only build: { target: "esnext" } with no chunking strategy (build.rollupOptions.output.manualChunks). Routes are already lazily imported in src/App.tsx, but these libraries are still liable to be pulled into large shared chunks, so users landing on a simple page (for example a contract or event view) may download the 3D graph and editor code they never use.

What needs to be done

  • Measure the current build output (npm run build) and record the chunk sizes in the issue/PR.
  • Add a manualChunks strategy separating: monaco-editor, the graph libraries (3d-force-graph, cytoscape, react-flow-renderer), and jszip/@webcontainer/api.
  • Ensure these libraries are only imported inside the lazily loaded routes that need them (no eager import from shared modules).
  • Re-measure and record the improvement.

Files

  • vite.config.ts
  • pages/components importing the heavy libraries

Acceptance deliverables

  • Heavy libraries are emitted as separate chunks and are not loaded on routes that do not use them.
  • Documented before/after chunk sizes showing an improvement in the initial payload.

Tests to pass

  • npm run build succeeds and the expected separate chunks are present in dist.
  • Existing tests continue to pass.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions