Skip to content

feat(console): bundle splitting, compression, and lazy MSW for optimized production release#464

Merged
hotlong merged 3 commits intomainfrom
copilot/update-roadmap-and-console-version
Feb 12, 2026
Merged

feat(console): bundle splitting, compression, and lazy MSW for optimized production release#464
hotlong merged 3 commits intomainfrom
copilot/update-roadmap-and-console-version

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 12, 2026

Console's main chunk was 3.7 MB (1,008 KB gzip) — a single monolithic bundle. This PR splits it into 17 cacheable chunks, adds pre-compression, and lazy-loads MSW to prepare for a production-quality console release.

Bundle splitting (vite.config.ts)

  • Added manualChunks splitting into: vendor-react, vendor-radix, vendor-icons, vendor-ui-utils, vendor-objectstack, vendor-zod, vendor-msw, vendor-charts, vendor-dndkit, vendor-i18n, framework, ui-components, ui-layout, infrastructure, plugins-core, plugins-views, data-adapter
  • Main entry: 1,008 KB → 48.5 KB gzip (95% reduction)
  • Disabled production source maps, enabled CSS code splitting

Compression

  • Added vite-plugin-compression2 for Gzip + Brotli pre-compression (threshold: 1 KB)
  • Added rollup-plugin-visualizerdist/stats.html for ongoing bundle monitoring

Lazy MSW loading (main.tsx)

// Before: static import — always bundled
import { startMockServer } from './mocks/browser';

// After: dynamic import — tree-shaken when VITE_USE_MOCK_SERVER=false
const { startMockServer } = await import('./mocks/browser');
  • build:server fully excludes MSW (~150 KB gzip saved)
  • Demo builds include MSW as a lazy chunk

Scripts (package.json)

  • Added build:analyze script
  • build:server no longer runs msw:init (not needed without MSW)

ROADMAP & CHANGELOG

  • Added Console v1.0 Production Release section (C.1–C.5) with before/after metrics
  • Marked Q3 §3.3 bundle performance target as complete
  • C.5 (CSP, cache headers docs, error tracking, perf budget CI) remains as future work

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 12, 2026 7:16am
objectui-demo Ready Ready Preview, Comment Feb 12, 2026 7:16am
objectui-storybook Error Error Feb 12, 2026 7:16am

Request Review

Copilot AI and others added 2 commits February 12, 2026 04:29
- Split monolithic 3.7MB index.js into 17 granular chunks via manualChunks
- Add Gzip + Brotli pre-compression (vite-plugin-compression2)
- Add bundle analysis (rollup-plugin-visualizer → dist/stats.html)
- Lazy-load MSW via dynamic import (excluded from build:server entirely)
- Remove MSW init from build:server script (not needed without MSW)
- Add build:analyze script for ongoing bundle monitoring
- Main chunk: 1,008KB gzip → 48.5KB gzip (95% reduction)
- Server mode: MSW completely tree-shaken (~150KB gzip saved)

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Add Console v1.0 Production Release section (C.1-C.5) with detailed
  optimization metrics and before/after comparisons
- Mark Q3 3.3 performance targets as complete (bundle optimization achieved)
- Update CHANGELOG with bundle optimization, compression, analysis entries
- Update ROADMAP header date and build count

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update roadmap and optimize console version feat(console): bundle splitting, compression, and lazy MSW for optimized production release Feb 12, 2026
Copilot AI requested a review from hotlong February 12, 2026 04:38
@hotlong hotlong marked this pull request as ready for review February 12, 2026 04:45
Copilot AI review requested due to automatic review settings February 12, 2026 04:45
@hotlong hotlong merged commit 567103d into main Feb 12, 2026
3 of 6 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Optimizes the Console app’s production build output by splitting the bundle into cacheable chunks, adding pre-compression, and lazy-loading MSW to reduce baseline payload; also updates release tracking docs.

Changes:

  • Add manualChunks strategy, disable prod sourcemaps, and enable CSS code splitting in the Console Vite build.
  • Add gzip + brotli pre-compression and bundle visualizer output generation.
  • Lazy-load MSW in Console bootstrap and update scripts/docs (ROADMAP + CHANGELOG) to reflect the production-release optimization milestone.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Locks new build tooling deps (compression + visualizer) and resulting dependency graph updates.
package.json Adds devDependencies for compression and bundle visualization tooling at the repo root.
apps/console/vite.config.ts Implements compression plugins, bundle visualizer, and extensive manualChunks splitting + build tweaks.
apps/console/src/main.tsx Switches MSW startup to a conditional dynamic import to allow tree-shaking in server builds.
apps/console/package.json Adjusts build scripts (build:server skips msw:init; adds build:analyze).
ROADMAP.md Adds Console v1.0 production release section + updates performance milestone notes.
CHANGELOG.md Documents the new bundling/compression/MSW changes under Unreleased.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +32 to +38
// Bundle analysis (generates stats.html in dist/)
visualizer({
filename: 'dist/stats.html',
gzipSize: true,
brotliSize: true,
open: false,
}),
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rollup-plugin-visualizer is enabled unconditionally, so every vite build will generate the stats HTML (and do the analysis work) even when the user didn’t ask for it. Consider enabling this plugin only when an explicit flag/script is used (e.g. ANALYZE=1 / --mode analyze) to avoid extra build time and incidental artifacts in normal production builds.

Copilot uses AI. Check for mistakes.
Comment thread apps/console/package.json
"build": "pnpm msw:init && tsc && vite build",
"build:server": "pnpm msw:init && tsc && VITE_USE_MOCK_SERVER=false vite build",
"build:server": "tsc && VITE_USE_MOCK_SERVER=false vite build",
"build:analyze": "pnpm build && echo 'Bundle analysis available at dist/stats.html'",
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build:analyze currently just runs pnpm build and prints a message; it doesn’t actually change build behavior. If the visualizer is meant to run only for analysis builds, update this script to set the flag/env var that enables it; otherwise consider dropping build:analyze to avoid having two scripts that do the same build.

Suggested change
"build:analyze": "pnpm build && echo 'Bundle analysis available at dist/stats.html'",

Copilot uses AI. Check for mistakes.
Comment thread ROADMAP.md
- ✅ TypeScript 5.9+ strict mode (100%)
- ✅ React 19 + Tailwind CSS + Shadcn UI
- ✅ All 41 builds pass, all 3011 tests pass
- ✅ All 42 builds pass, all 3011 tests pass
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line updates build/test counts, but it now conflicts with the earlier “41/41 builds pass, 2961/2961 tests pass” claim in the Executive Summary. Please reconcile the numbers in one place (and ideally derive them from CI output) so the roadmap stays internally consistent.

Suggested change
- ✅ All 42 builds pass, all 3011 tests pass
- ✅ All 41 builds pass, all 2961 tests pass

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants