Skip to content

Performance: fixed ~700KB client bundle with no way to disable unused features or add LCP hints #7195

Description

@wislertt

Environment

Site https://leetcode-py.wisl.dev (custom domain, Mintlify hosted)
Plan Free
Theme mint
Features in use docs content only. No analytics, no Assistant (locked on free), no Widget, no personalization
Lighthouse 13.4.1, mobile emulation, simulated throttling
PageSpeed Insights 67 mobile / 86 desktop

Symptoms

Static documentation page with zero interactivity scores 67 on mobile. Metrics from a local Lighthouse run on the production site:

Metric Value
FCP 3.1s
LCP 8.4s (simulated) / 2.3s observed
TBT 150ms
CLS 0
Speed Index 5.6s
TTI 8.5s
Total transfer 1.2MB across 61 requests

Root cause analysis

1. Core bundle ships loaders for features that are not configured

/_next/static/chunks/62d7203315893733.js is 683KB uncompressed (175KB over the wire). It contains SDK loaders for posthog, plausible, fathom, kapa, Assistant UI, and MCP surfaces. This site has none of them enabled, but the code ships and executes anyway. Lighthouse reports 180KB unused JavaScript. Total script weight is around 700KB for a page that renders server-side and needs no client state.

2. Fonts preloaded unconditionally

Three woff2 files (150KB, including PaperMono variable) are preloaded in <head> on every page. Preload gives them highest priority, so they compete with the LCP image for bandwidth on throttled connections.

3. Render-blocking CSS

One 67KB stylesheet blocks first paint. The Lighthouse render-blocking audit reports 750ms wasted.

4. LCP image gets no priority hints

The actual LCP element on our landing page is a content hero image served from mintcdn.com. Tracing shows:

  • lcpLoadDelay = 1.8s
  • No <link rel="preconnect" href="https://mintcdn.com"> anywhere in the document
  • No fetchpriority="high" on the LCP image (Lighthouse lcp-discovery: fetchpriority=high should be applied: false)
  • Meanwhile Mintlify preloads both nav logo SVG variants (light and dark), one of which is always hidden by CSS

So the browser spends its preload budget on decorative logos while the LCP image discovers its CDN origin cold, mid page load.

Workarounds attempted (all limited or unavailable)

  1. docs.json has no head field, so a preconnect or LCP preload cannot be injected.
  2. search config only accepts a placeholder prompt; there is no way to disable search to shed its JS.
  3. Added fetchpriority="high" loading="eager" on the hero <img> in MDX. Helps only if the platform does not strip it.
  4. <link rel="preconnect"> in MDX body. Relies on React hoisting, not guaranteed.
  5. Checked every dashboard settings page (Search, Assistant, Add-ons, General): no bundle, font, or performance controls exist.

The platform cost is identical on the free plan and paid plans, and none of it is opt-out.

Requests

  1. Feature-flag the core chunk. Split analytics loaders, Assistant, and MCP surfaces into lazy chunks loaded only when the corresponding feature is configured. An empty-config docs site should not ship or execute them.
  2. Conditional font preload, or a font-display: optional fallback so fonts stop competing with LCP.
  3. LCP-aware hints for hosted sites: preconnect to mintcdn.com and preload only the visible logo variant. Better, expose a head array in docs.json so customers can add their own preconnect and preload tags.
  4. Guidance: if any plan or theme config reduces the bundle (lighter theme, disabled features), document it. Happy to test.

Reproduce

bunx lighthouse https://leetcode-py.wisl.dev/ --output=json \
  --output-path=/tmp/lh.json --only-categories=performance \
  --chrome-flags="--headless=new" --form-factor=mobile --screenEmulation.mobile

Or paste the URL into pagespeed.web.dev. The unused-JS audit points at the chunk named above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions