[PR #942] [MERGED] fix: resolve symlink paths in standalone BFS package copy (#724) #969

Closed
opened 2026-05-06 13:11:19 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/942
Author: @Divkix
Created: 4/28/2026
Status: Merged
Merged: 4/28/2026
Merged by: @james-elicx

Base: mainHead: fix/724-standalone-e2e


📝 Commits (2)

  • 2d410b2 fix: resolve symlink paths in standalone BFS package copy (#724)
  • fa7bc1f fix: address review feedback

📊 Changes

12 files changed (+175 additions, -3 deletions)

View changed files

📝 .github/workflows/ci.yml (+1 -0)
📝 packages/vinext/src/build/standalone.ts (+4 -3)
📝 playwright.config.ts (+14 -0)
📝 pnpm-lock.yaml (+19 -0)
tests/e2e/standalone-output/basic.spec.ts (+65 -0)
tests/fixtures/standalone-output/next.config.mjs (+6 -0)
tests/fixtures/standalone-output/package.json (+14 -0)
tests/fixtures/standalone-output/pages/about.tsx (+15 -0)
tests/fixtures/standalone-output/pages/api/hello.ts (+5 -0)
tests/fixtures/standalone-output/pages/index.tsx (+15 -0)
tests/fixtures/standalone-output/tsconfig.json (+11 -0)
tests/fixtures/standalone-output/vite.config.ts (+6 -0)

📄 Description

Fixes #724

Summary

  • Fix standalone output build failure caused by symlinked package paths in pnpm. When resolvePackageJsonPath finds a package via the lookup-paths fallback, the returned path is a symlink (e.g., under a hoisted node_modules/). createRequire() on this symlink path cannot resolve transitive dependencies because Node walks up from the symlink ancestor directories.
  • The fix: call fs.realpathSync() on the resolved package.json path before using it for createRequire() and readPackageJson().

Test plan

  • Added E2E test fixture tests/fixtures/standalone-output/ with output: "standalone" config
  • Added E2E test project standalone-output to playwright.config.ts that builds the fixture and starts node dist/standalone/server.js
  • Added E2E test tests/e2e/standalone-output/basic.spec.ts covering index page, about page, navigation via Link, browser back button, API route, 404 handling, and server header
  • All 9 existing standalone build unit tests continue to pass

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/942 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 4/28/2026 **Status:** ✅ Merged **Merged:** 4/28/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/724-standalone-e2e` --- ### 📝 Commits (2) - [`2d410b2`](https://github.com/cloudflare/vinext/commit/2d410b2b96950cab938b98cb2636117f91115e10) fix: resolve symlink paths in standalone BFS package copy (#724) - [`fa7bc1f`](https://github.com/cloudflare/vinext/commit/fa7bc1fc397a914d88434f5a456dadc861bbfc19) fix: address review feedback ### 📊 Changes **12 files changed** (+175 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+1 -0) 📝 `packages/vinext/src/build/standalone.ts` (+4 -3) 📝 `playwright.config.ts` (+14 -0) 📝 `pnpm-lock.yaml` (+19 -0) ➕ `tests/e2e/standalone-output/basic.spec.ts` (+65 -0) ➕ `tests/fixtures/standalone-output/next.config.mjs` (+6 -0) ➕ `tests/fixtures/standalone-output/package.json` (+14 -0) ➕ `tests/fixtures/standalone-output/pages/about.tsx` (+15 -0) ➕ `tests/fixtures/standalone-output/pages/api/hello.ts` (+5 -0) ➕ `tests/fixtures/standalone-output/pages/index.tsx` (+15 -0) ➕ `tests/fixtures/standalone-output/tsconfig.json` (+11 -0) ➕ `tests/fixtures/standalone-output/vite.config.ts` (+6 -0) </details> ### 📄 Description Fixes #724 ## Summary - Fix standalone output build failure caused by symlinked package paths in pnpm. When `resolvePackageJsonPath` finds a package via the lookup-paths fallback, the returned path is a symlink (e.g., under a hoisted `node_modules/`). `createRequire()` on this symlink path cannot resolve transitive dependencies because Node walks up from the symlink ancestor directories. - The fix: call `fs.realpathSync()` on the resolved `package.json` path before using it for `createRequire()` and `readPackageJson()`. ## Test plan - Added E2E test fixture `tests/fixtures/standalone-output/` with `output: "standalone"` config - Added E2E test project `standalone-output` to `playwright.config.ts` that builds the fixture and starts `node dist/standalone/server.js` - Added E2E test `tests/e2e/standalone-output/basic.spec.ts` covering index page, about page, navigation via Link, browser back button, API route, 404 handling, and server header - All 9 existing standalone build unit tests continue to pass --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:19 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#969
No description provided.