Skip to content

Commit cc0e28c

Browse files
angusbezzinaclaude
andcommitted
fix: clean up broken symlinks after .pnpm removal, keep root next/
After deleting .pnpm/, symlinks in apps/web/node_modules/ become dangling and break cp -r. Remove broken symlinks before copying. Since apps/web/node_modules/next is now gone, server.js resolves from root node_modules/next — so don't delete that copy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent de07b3e commit cc0e28c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/build-local.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ rm -rf "$STANDALONE_WEB/public/demos"
159159
find "$STANDALONE_DIR/node_modules" \( -name "*.md" -o -name "CHANGELOG*" -o -name "changelog*" \) -delete 2>/dev/null || true
160160
find "$STANDALONE_DIR/node_modules" \( -name "__tests__" -o -name "test" -o -name "tests" -o -name ".github" \) -type d -exec rm -rf {} + 2>/dev/null || true
161161

162+
# Remove broken symlinks left after .pnpm deletion (e.g. apps/web/node_modules/next -> .pnpm/...)
163+
find "$STANDALONE_DIR" -type l ! -exec test -e {} \; -delete 2>/dev/null || true
164+
162165
# ---------------------------------------------------------------------------
163166
# Step 5: Copy entire standalone tree into bundle/ (preserving layout)
164167
# ---------------------------------------------------------------------------
@@ -168,9 +171,6 @@ echo -e "${CYAN}[5/6] Assembling bundle...${NC}"
168171
rm -rf "$BUNDLE_DIR"
169172
cp -r "$STANDALONE_DIR" "$BUNDLE_DIR"
170173

171-
# Remove duplicate root-level Next.js (server.js resolves from apps/web/node_modules/next)
172-
rm -rf "$BUNDLE_DIR/node_modules/next"
173-
174174
# ---------------------------------------------------------------------------
175175
# Step 6: Copy LICENSE into package directory for npm
176176
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)