Backport #2813: Fix Next watcher with custom distDir#2818
Backport #2813: Fix Next watcher with custom distDir#2818github-actions[bot] wants to merge 2 commits into
Conversation
Signed-off-by: Nathan Colosimo <110621881+NathanColosimo@users.noreply.github.com>
🦋 Changeset detectedLatest commit: b8fa3d9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests▲ Vercel Production (12 failed)astro (1 failed):
example (1 failed):
express (1 failed):
fastify (1 failed):
hono (1 failed):
nextjs-turbopack (2 failed):
nextjs-webpack (1 failed):
nitro (1 failed):
nuxt (1 failed):
sveltekit (1 failed):
vite (1 failed):
🌍 Community Worlds (102 failed)redis (19 failed):
turso (83 failed):
Details by Category❌ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Signed-off-by: Nathan Colosimo <110621881+NathanColosimo@users.noreply.github.com>
TooTallNate
left a comment
There was a problem hiding this comment.
Verified the backport against the original #2813, with particular attention to the conflict adaptation. Approving.
The interesting part is the normalizedDistDir line, which correctly does NOT match the original. On main, normalizePath internally resolves relative paths against this.config.workingDir, so normalizePath(this.config.distDir) produces an absolute path there. Stable's normalizePath only normalizes slashes — a literal port (which is what the initial cherry-pick had) would have compared a relative distDir like .next against Watchpack's absolute pathnames and never matched, silently reintroducing the bug. The follow-up commit wrapping it in resolve(this.config.workingDir, ...) reproduces main's exact semantics on stable's simpler helper. I verified both branches' normalizePath implementations and the path spaces being compared (absolute in both consumers) to confirm the adaptation is semantically identical to the original.
Also verified: changeset carried over intact, resolve already imported on stable, and @workflow/next builds clean on the branch. The one CI failure (Community World Turso) is the known stable-lane flake, unrelated to a Next dev-watcher change.
Automated backport of #2813 to
stable(backport job run).AI recommendation: This is a self-contained bug fix to the Next dev watcher's ignore logic in
packages/next/src/builder-eager.ts, which exists onstablewith the samehasIgnoredPathFragment/normalizedGeneratedDirstructure being patched. The fix (ignoring a customdistDir) applies equally tostableand does not depend on anymain-only APIs.Merge conflicts were resolved by AI (opencode with
anthropic/claude-opus-4.8). Please review the conflict resolution carefully before merging.