fix(PBI-58): pin turbopack root to cwd so worktrees resolve own node_modules

Multi-lockfile setups (e.g. running dev/build from inside a git worktree
under .claude/worktrees/) caused Next.js to climb up to the parent repo's
package-lock.json and resolve modules from the parent's node_modules,
which doesn't have the new manual-rendering deps installed. Pinning
turbopack.root to process.cwd() keeps each invocation scoped to the
directory it was launched from.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-07 18:07:01 +02:00
parent 4a790f830f
commit bdd0398eb6

View file

@ -5,6 +5,11 @@ import pkg from "./package.json"
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
reactStrictMode: true, reactStrictMode: true,
serverExternalPackages: ['sharp'], serverExternalPackages: ['sharp'],
// Pin Turbopack workspace root to the invocation directory so worktrees
// resolve their own node_modules instead of climbing into an outer lockfile.
turbopack: {
root: process.cwd(),
},
env: { env: {
NEXT_PUBLIC_APP_VERSION: pkg.version, NEXT_PUBLIC_APP_VERSION: pkg.version,
NEXT_PUBLIC_BUILD_DATE: new Date().toISOString(), NEXT_PUBLIC_BUILD_DATE: new Date().toISOString(),