Skip to content

client: keep dev tooling out of production builds + split vendor chunk - #561

Open
Clarkcj12 wants to merge 1 commit into
Mindgamesnl:masterfrom
Clarkcj12:client-build-optimizations
Open

Clarkcj12 wants to merge 1 commit into
Mindgamesnl:masterfrom
Clarkcj12:client-build-optimizations

Conversation

@Clarkcj12

Copy link
Copy Markdown

What

  • Gate MillionLint and vite-plugin-eslint to dev only (command === 'serve'). They were in the plugins array unconditionally, so vite build ran the Million Lint transform + a full ESLint pass and shipped profiler instrumentation in the production bundle. Million is now loaded via a dynamic import() inside the dev-only branch, so a production build never needs the package.
  • Move @million/lint to devDependencies.
  • build.rollupOptions.output.manualChunks: put everything from node_modules into a single vendor chunk. The client previously shipped as one ~585 kB (175 kB gzip) file, so any app-code change invalidated the whole bundle for returning visitors. The ~300 kB (96 kB gzip) vendor chunk now keeps a stable hash across app-only changes.

Why

  • Faster builds — locally ~20s → ~10s
  • No third-party profiling/telemetry running in end users' browsers
  • Returning visitors re-download only the app chunk on a redeploy, not the whole vendor blob

Testing

  • npm run build succeeds; node --check passes on both output bundles
  • npm run lint clean
  • npm run start (dev) still loads Million Lint + the eslint overlay

- Gate MillionLint and vite-plugin-eslint behind `command === 'serve'`.
  They were running in `vite build`, adding ~10s of build time and shipping
  profiler instrumentation to the client. Million is now a dynamic import so
  a production build never needs the (dev-only) package.
- Move @million/lint to devDependencies.
- manualChunks: split node_modules into a stable `vendor` chunk so an
  app-only change between deploys keeps the large, rarely-changing vendor
  bundle cached in browsers and at the CDN edge.

Local build time drops from ~20s to ~10s.
Copilot AI lite review requested due to automatic review settings September 1, 2026 02:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are scoped to build tooling/configuration and appear internally consistent (dev-only gating + dependency move + chunking) without introducing breaking behavior for vite build.

Pull request overview

This PR updates the client’s Vite configuration to ensure development-only tooling (Million Lint + Vite ESLint plugin) does not run during production builds, and improves client-side caching by splitting third-party dependencies into a dedicated vendor chunk.

Changes:

  • Make vite.config.js conditional on command, dynamically importing @million/lint and enabling vite-plugin-eslint only for vite serve.
  • Configure Rollup manualChunks to bundle all node_modules code into a single vendor chunk.
  • Move @million/lint from dependencies to devDependencies.
File summaries
File Description
client/vite.config.js Gates dev-only plugins behind command === 'serve' and adds a vendor manual chunk for better caching.
client/package.json Moves @million/lint to devDependencies to reflect dev-only usage.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants