Two additive `next.config.ts` tweaks for v1.4.34:
- `outputFileTracingExcludes: { "*": ["./next.config.ts"] }` — silences
the Turbopack tracer warnings emitted during `next build`. The tracer
follows the `MAXMIND_LICENSE_KEY` env access in `src/lib/geo.ts` back
into the config file and emits "cannot be traced" warnings for every
path it tried to walk afterwards. The standalone bundle is still
controlled by `output: "standalone"`; the exclude only narrows trace
reporting and has no runtime effect.
- A second `headers()` rule (source: `/((?!api|_next).*)`) stamps
`Cache-Control: private, max-age=0, must-revalidate` on every
authenticated HTML page response. The Next.js framework default for
pages that touch cookies is `no-store, must-revalidate`, which
Chromium counts as a hard bfcache breaker; the rule above replaces
that on the page tree while leaving `/api/*` and `/_next/*` alone so
API routes keep their explicit directives and static assets keep
immutable caching. Pairs with the `Permissions-Policy: unload=()`
hint already in place to restore back/forward-cache eligibility for
every authed route.
Lighthouse v1.4.33 flagged ~463 KiB of unused JS on first /insights
paint plus ~211 KiB of bundled JS as unminified. Two coordinated
moves close the gap without touching the Coach panel internals or
the dashboard tree.
next.config.ts
- `compiler.removeConsole` with `exclude: ["error", "warn"]` strips
the chart-wiring + Coach SSE breadcrumb literals from the prod
bundle. Error + warn paths still flow through to GlitchTip.
- `headers()` advertises `Permissions-Policy: unload=()` so Chromium
admits the page to the back/forward cache when navigating away. We
carry no `beforeunload` / `unload` listeners in-tree so the hint is
honest.
src/app/insights/page.tsx
- `<DailyBriefing>`, `<CorrelationRow>`, `<TrendsRow>` move behind
`next/dynamic({ ssr: false, loading: <Skeleton /> })`. All three
paint below the hero on every viewport and were eagerly imported
before. Each loader skeleton matches the dimensions of the resolved
block so layout doesn't shift.
- `<HeroStrip>` stays an eager import — the greeting + health-score
badge are the visible-first-paint surface.
Turbopack rewrites `__dirname` to a synthetic `/ROOT/...` token at
build time, so `readFileSync(join(__dirname, 'safety-contracts.fr.yaml'))`
crashed during page-data collection in the Docker build with an
ENOENT. The chunk error fixed in the previous commit was hiding the
issue.
The path now resolves through `process.cwd() + 'src/lib/ai/prompts'`,
which stays stable across `next build`, `next start`, and the test
runner. `outputFileTracingIncludes` in `next.config.ts` pulls the YAML
siblings into the standalone runtime image so the read succeeds at
deploy time.
HealthLog — personal health-tracking PWA with weight, blood pressure,
pulse, mood tracking, medication compliance, Withings integration,
doctor report PDF export, and Dracula-themed UI.