Skip to content

chore(dev): switch local dev server to Turbopack - #26

Merged
CodeWithEugene merged 1 commit into
mainfrom
chore/turbopack-dev
Sep 24, 2026
Merged

CodeWithEugene merged 1 commit into
mainfrom
chore/turbopack-dev

Conversation

@CodeWithEugene

Copy link
Copy Markdown
Owner

Summary

Root-caused the "localhost keeps breaking, have to cancel and restart" issue: the webpack dev server's incremental compile cache repeatedly corrupted after file churn outside the normal edit-save cycle (git branch switches, resets, checkouts) — surfacing as a Cannot find module './XXXX.js' 500 that only cleared after killing the server, deleting .next, and restarting. This happened repeatedly during this session's work.

  • pnpm dev now runs next dev --turbopack. Turbopack's content-addressed, function-level incremental caching doesn't share webpack dev's failure mode here.
  • pnpm dev:clean added as a one-command fallback (rm -rf .next && next dev --turbopack) for the rare case a hard reset is still needed.
  • build/start are untouched — Turbopack is dev-only, production build stays on the more battle-tested webpack path.

Test plan

  • pnpm run typecheck / pnpm run lint — clean
  • pnpm exec vitest run tests/unit — 98/98 passing
  • pnpm run build — production build succeeds (unaffected by this change)
  • pnpm dev starts under Turbopack, compiles, and serves pages including DB-backed ones (/events, /developers)
  • Hot reload confirmed working on a live edit
  • Reproduced the actual failure trigger — create branch, switch, delete, git stash pop — while the dev server stayed running, then hit a page not yet compiled in that session. No corruption, no restart needed.

The webpack dev server's incremental compile cache repeatedly
corrupted after file churn outside the normal edit-save cycle (git
branch switches, resets, checkouts) — surfacing as a "Cannot find
module './XXXX.js'" 500 that only cleared after killing the server,
deleting .next, and restarting. Turbopack's content-addressed,
function-level caching doesn't share that failure mode.

Verified: `pnpm dev` compiles and serves the app correctly (including
DB-backed pages), hot reload still works, and it survives a
create-branch / switch / delete / stash-pop cycle — the exact kind of
git churn that broke the old dev server every time.

Production `build` is untouched; Turbopack is dev-only here.

Also adds `pnpm dev:clean` (rm -rf .next && next dev --turbopack) as a
one-command fallback for the rare case a restart is still needed.
@CodeWithEugene
CodeWithEugene merged commit 1bfbf56 into main Sep 24, 2026
5 checks passed
@CodeWithEugene
CodeWithEugene deleted the chore/turbopack-dev branch September 24, 2026 20:35
Repository owner deleted a comment from vercel Bot Sep 25, 2026

This branch was successfully deployed

1 active deployment
Preview — 6c391858 Deployed Sep 24, 2026 by vercel[bot]
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.

1 participant