Skip to content

Build: lazy-load LocalHistoryDialog from FilesExplorer to silence chunk warning and actually defer it #55

Description

@NicolaasGrobler

Problem

src/components/ui/LocalHistoryDialog.tsx is imported two ways:

  • Statically from src/components/explorer/FilesExplorer.tsx:4
  • Dynamically (via lazy()) from src/components/layout/MainContent.tsx:36

Rollup's static import wins, so the lazy() in MainContent has zero effect — the dialog ends up in FilesExplorer's eager chunk and is loaded as part of the cold-start path anyway. Vite warns about this on every npm run build:

LocalHistoryDialog.tsx is dynamically imported by … MainContent.tsx but also statically imported by … FilesExplorer.tsx, dynamic import will not move module into another chunk.

Fix

Convert FilesExplorer.tsx's static import to a lazy() + Suspense wrapper that matches the pattern in MainContent.tsx. Once both sites are lazy, Rollup splits the dialog into its own chunk and the warning disappears.

Acceptance

  • npm run build no longer emits the "dynamic import will not move module into another chunk" warning for LocalHistoryDialog.tsx.
  • The dialog still opens correctly from both Files Explorer and the editor's local-history button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersperformancePerformance and bundle sizerefactorCode restructuring without behavior change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions