fix: resolve Vite build warnings for mixed static/dynamic imports #473

Merged
ghost merged 3 commits from main into dev-1.10.1 2026-01-02 00:43:38 +00:00
ghost commented 2026-01-01 17:45:24 +00:00 (Migrated from github.com)

Summary

This PR resolves Vite build warnings about mixed static and dynamic imports that were preventing proper code-splitting.

Changes

  • Convert all dynamic imports of main-axios.ts to static imports across 10 files
  • Convert all dynamic imports of sonner to static imports across 4 files
  • Add manual chunking configuration to vite.config.ts for better bundle splitting:
    • react-vendor: React and React DOM
    • ui-vendor: Radix UI components, lucide-react, clsx, tailwind-merge
    • monaco: Monaco Editor
    • codemirror: CodeMirror and related packages
  • Increase chunkSizeWarningLimit to 1000kB

Files Modified

  • src/ui/desktop/DesktopApp.tsx
  • src/ui/desktop/navigation/hosts/Host.tsx
  • src/ui/desktop/apps/host-manager/hosts/HostManagerViewer.tsx
  • src/ui/desktop/apps/host-manager/hosts/HostManagerEditor.tsx
  • src/ui/desktop/apps/features/server-stats/ServerStats.tsx
  • src/ui/desktop/apps/features/tunnel/TunnelManager.tsx
  • src/ui/desktop/apps/features/docker/DockerManager.tsx
  • src/ui/desktop/apps/features/terminal/Terminal.tsx
  • src/ui/desktop/user/UserProfile.tsx
  • src/ui/desktop/apps/host-manager/credentials/CredentialSelector.tsx
  • src/ui/desktop/apps/dashboard/apps/alerts/AlertManager.tsx
  • src/ui/main-axios.ts
  • vite.config.ts

Test Plan

  • Build completes successfully with no errors
  • No more "dynamic import will not move module into another chunk" warnings
  • Bundle properly split into vendor chunks

Before

(!) /home/agent/Termix/src/ui/main-axios.ts is dynamically imported by ...
... (many files)
dynamic import will not move module into another chunk.

After

Build completes cleanly with proper chunking:

dist/assets/react-vendor-BzrpNAyj.js     11.92 kB │ gzip:     4.25 kB
dist/assets/ui-vendor-Bk_hp57T.js       207.02 kB │ gzip:    59.19 kB
dist/assets/codemirror-BLQzba1F.js      407.69 kB │ gzip:   132.38 kB
dist/assets/index-C20Y6l7V.js         8,224.15 kB │ gzip: 2,381.45 kB

✓ built in 38.00s

🤖 Generated with Claude Code

## Summary This PR resolves Vite build warnings about mixed static and dynamic imports that were preventing proper code-splitting. ## Changes - Convert all dynamic imports of `main-axios.ts` to static imports across 10 files - Convert all dynamic imports of `sonner` to static imports across 4 files - Add manual chunking configuration to `vite.config.ts` for better bundle splitting: - `react-vendor`: React and React DOM - `ui-vendor`: Radix UI components, lucide-react, clsx, tailwind-merge - `monaco`: Monaco Editor - `codemirror`: CodeMirror and related packages - Increase `chunkSizeWarningLimit` to 1000kB ## Files Modified - `src/ui/desktop/DesktopApp.tsx` - `src/ui/desktop/navigation/hosts/Host.tsx` - `src/ui/desktop/apps/host-manager/hosts/HostManagerViewer.tsx` - `src/ui/desktop/apps/host-manager/hosts/HostManagerEditor.tsx` - `src/ui/desktop/apps/features/server-stats/ServerStats.tsx` - `src/ui/desktop/apps/features/tunnel/TunnelManager.tsx` - `src/ui/desktop/apps/features/docker/DockerManager.tsx` - `src/ui/desktop/apps/features/terminal/Terminal.tsx` - `src/ui/desktop/user/UserProfile.tsx` - `src/ui/desktop/apps/host-manager/credentials/CredentialSelector.tsx` - `src/ui/desktop/apps/dashboard/apps/alerts/AlertManager.tsx` - `src/ui/main-axios.ts` - `vite.config.ts` ## Test Plan - [x] Build completes successfully with no errors - [x] No more "dynamic import will not move module into another chunk" warnings - [x] Bundle properly split into vendor chunks ## Before ``` (!) /home/agent/Termix/src/ui/main-axios.ts is dynamically imported by ... ... (many files) dynamic import will not move module into another chunk. ``` ## After Build completes cleanly with proper chunking: ``` dist/assets/react-vendor-BzrpNAyj.js 11.92 kB │ gzip: 4.25 kB dist/assets/ui-vendor-Bk_hp57T.js 207.02 kB │ gzip: 59.19 kB dist/assets/codemirror-BLQzba1F.js 407.69 kB │ gzip: 132.38 kB dist/assets/index-C20Y6l7V.js 8,224.15 kB │ gzip: 2,381.45 kB ✓ built in 38.00s ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LukeGus commented 2026-01-02 00:43:40 +00:00 (Migrated from github.com)

LGTM. Considered doing this for a while, but never got around to it. Thanks.

LGTM. Considered doing this for a while, but never got around to it. Thanks.
Sign in to join this conversation.