Skip to content

chore(repo): add dev:fresh script (wipes Next caches before starting)#21

Merged
ptengelmann merged 1 commit into
mainfrom
chore/dev-fresh-script
Jun 28, 2026
Merged

chore(repo): add dev:fresh script (wipes Next caches before starting)#21
ptengelmann merged 1 commit into
mainfrom
chore/dev-fresh-script

Conversation

@ptengelmann

Copy link
Copy Markdown
Owner

Summary

Adds pnpm dev:fresh that wipes apps/*/.next and apps/*/.turbo before running pnpm dev. Standard pnpm dev is unchanged.

Why

Hit Next.js dev-cache corruption three times in one calibration session. Root cause: heavy branch switching and PR merges leave the running Next dev servers with a stale in-memory module graph; webpack-runtime can't find chunks; every /_next/static/* returns 404 and the page won't render. Symptom is always the same Cannot find module './<N>.js' error.

The fix has been the same three times: kill the dev servers, rm -rf .next, restart. Now it's one command.

Test plan

  • pnpm typecheck - 9/9 workspaces pass (no code changes, just a script)
  • pnpm check - clean
  • pnpm build - clean

Moat level

L1 - developer ergonomics, not product. Reduces the friction of a known recurring issue.

After heavy branch-switching, PR merges, or installs touching apps/,
the running Next dev servers can lose track of their webpack module
graph and start returning 404 for every /_next/static/* chunk. Hit
this three times in one calibration session.

dev:fresh removes apps/*/.next and apps/*/.turbo before running pnpm
dev so a session that starts with this command is guaranteed a clean
Next build. Standard `pnpm dev` is unchanged for users who want to
keep an existing cache.
@ptengelmann
ptengelmann merged commit 724695d into main Jun 28, 2026
1 check passed
@ptengelmann
ptengelmann deleted the chore/dev-fresh-script branch June 28, 2026 01:09
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