[GH-ISSUE #1577] [Feature]: Add an explicit Vite manual chunk policy for framework and vendor code #816

Closed
opened 2026-10-21 05:21:29 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Xelvanis on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1577

Originally assigned to: @cha1latte on GitHub.

What problem does this solve?

vite.config.ts currently has no build.rollupOptions.output.manualChunks policy. After feature-level eager imports are cleaned up, the startup bundle may still be noisy because framework and vendor modules are grouped into the entry chunk by default.

Current startup entry vendor contributors include:

  • React DOM client production build;
  • Zod;
  • Tailwind Merge;
  • @dnd-kit/core;
  • DOMPurify;
  • Motion/Framer Motion internals;
  • Sonner;
  • Tauri window API.

Without an explicit chunk policy, the warning remains ambient and it is harder to tell whether a future warning is framework cost, feature leakage, or a real regression.

Proposed behavior

Define a small, intentional manual chunk policy in vite.config.ts after the eager feature import fixes are handled.

The policy should prefer stable, cache-friendly groups instead of many tiny chunks. Candidate groups:

  • React/framework runtime;
  • query/state/runtime utilities;
  • large UI support libraries such as motion, drag-and-drop, sanitizer, and toast;
  • Tauri/browser runtime helpers where useful.

Also decide whether to document or raise build.chunkSizeWarningLimit only after the remaining large chunks are intentional.

Expected owner or impact area

  • App shell, navigation, startup, or providers
  • Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Refactor branch considerations

This should not change product behavior. Keep the chunk policy boring and reviewable; avoid using chunkSizeWarningLimit alone as the fix unless maintainers explicitly decide the current bundle shape is acceptable.

Acceptance checks:

  • pnpm build passes.
  • The build output has intentional framework/vendor chunks instead of one monolithic startup entry.
  • The Vite large chunk warning is gone, or any remaining warning is documented with a clear threshold decision.
  • Route and panel lazy chunks still load correctly in Tauri desktop.

Alternatives considered

Raising chunkSizeWarningLimit first would quiet the warning but would not improve cacheability or make future feature leakage visible.

Additional context

This is one implementation slice under #1532 and should probably come after the startup import and background autonomous slices.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1577 Originally assigned to: @cha1latte on GitHub. ## What problem does this solve? `vite.config.ts` currently has no `build.rollupOptions.output.manualChunks` policy. After feature-level eager imports are cleaned up, the startup bundle may still be noisy because framework and vendor modules are grouped into the entry chunk by default. Current startup entry vendor contributors include: - React DOM client production build; - Zod; - Tailwind Merge; - `@dnd-kit/core`; - DOMPurify; - Motion/Framer Motion internals; - Sonner; - Tauri window API. Without an explicit chunk policy, the warning remains ambient and it is harder to tell whether a future warning is framework cost, feature leakage, or a real regression. ## Proposed behavior Define a small, intentional manual chunk policy in `vite.config.ts` after the eager feature import fixes are handled. The policy should prefer stable, cache-friendly groups instead of many tiny chunks. Candidate groups: - React/framework runtime; - query/state/runtime utilities; - large UI support libraries such as motion, drag-and-drop, sanitizer, and toast; - Tauri/browser runtime helpers where useful. Also decide whether to document or raise `build.chunkSizeWarningLimit` only after the remaining large chunks are intentional. ## Expected owner or impact area - [x] App shell, navigation, startup, or providers - [ ] Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [x] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [x] Docs, contributor workflow, or templates ## Refactor branch considerations This should not change product behavior. Keep the chunk policy boring and reviewable; avoid using `chunkSizeWarningLimit` alone as the fix unless maintainers explicitly decide the current bundle shape is acceptable. Acceptance checks: - `pnpm build` passes. - The build output has intentional framework/vendor chunks instead of one monolithic startup entry. - The Vite large chunk warning is gone, or any remaining warning is documented with a clear threshold decision. - Route and panel lazy chunks still load correctly in Tauri desktop. ## Alternatives considered Raising `chunkSizeWarningLimit` first would quiet the warning but would not improve cacheability or make future feature leakage visible. ## Additional context This is one implementation slice under #1532 and should probably come after the startup import and background autonomous slices. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@cha1latte commented on GitHub (May 29, 2026):

Triage note: labeling this as scope-risk because a manual chunk policy affects framework/vendor loading behavior and can create brittle bundle boundaries if chosen only to silence warnings.

A good next step is to measure current contributors and choose a durable policy before adding manual chunks.

<!-- gh-comment-id:4578272882 --> @cha1latte commented on GitHub (May 29, 2026): Triage note: labeling this as `scope-risk` because a manual chunk policy affects framework/vendor loading behavior and can create brittle bundle boundaries if chosen only to silence warnings. A good next step is to measure current contributors and choose a durable policy before adding manual chunks.
Author
Owner

@cha1latte commented on GitHub (May 31, 2026):

closed in #1756

<!-- gh-comment-id:4588468613 --> @cha1latte commented on GitHub (May 31, 2026): closed in #1756
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#816
No description provided.