mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #146] [CLOSED] fix: resolve vinext imports under pnpm strict hoisting #349
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#349
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/146
Author: @jpoindexter
Created: 2/26/2026
Status: ❌ Closed
Base:
main← Head:fix/pnpm-strict-hoisting📝 Commits (2)
fbe7652fix: resolve vinext imports under pnpm strict hoistingbb72949fix: use createBuilder().buildApp() for Pages Router deploy📊 Changes
2 files changed (+30 additions, -29 deletions)
View changed files
📝
packages/vinext/src/deploy.ts(+5 -14)📝
packages/vinext/src/index.ts(+25 -15)📄 Description
Summary
Fixes three issues that break vinext under pnpm strict hoisting (the default mode), affecting both standalone pnpm projects and pnpm workspaces.
All three issues are invisible under npm/yarn flat hoisting but cause hard failures with pnpm.
1.
@vitejs/plugin-rscresolution fallbackProblem:
@vitejs/plugin-rscis a dependency of vinext, but under pnpm strict hoisting it is NOT symlinked to the consumer'snode_modules/. ThecreateRequire()call at line ~1591 resolves from the consumer project root, which fails because the consumer never declared@vitejs/plugin-rscas a dependency.Fix: Add a fallback
try/catchthat resolves from vinext's own location viacreateRequire(import.meta.url).2.
vinext/shims/*resolveId for Rollup SSR buildsProblem: The
resolveIdhook filter regex (/(?:next\/|virtual:vinext-)/) does not matchvinext/imports. During Rollup SSR production builds, imports likevinext/shims/documentfail to resolve because Rollup's bundler doesn't reliably follow the"./shims/*"package exports glob through pnpm symlinks.Fix: Extend the
resolveIdfilter to includevinext\/and add a handler that resolvesvinext/shims/*to the shims directory (with path traversal guard).3. Pages Router deploy fails:
Could not resolve entry module "index.html"Problem:
vinext deploycalls Vite'sbuild()JS API for Pages Router projects.build()forces the legacy single-environment builder path which ignores per-environment configs set by thecloudflare()plugin and falls back to looking forindex.html— which doesn't exist in Pages Router mode.App Router worked because it already used
createBuilder().buildApp().Fix: Use
createBuilder().buildApp()for both routers. Thecloudflare()plugin sets a custombuildAppthat orchestrates multi-environment builds (worker + client), which is required for both router types.Test plan
pnpm build— vinext package builds cleanlypnpm test— 50 files, 2,011 tests pass, 3 skipped (no regressions)Reproduction
Built with FABRK Framework — discovered while building the first AI-first React framework on top of vinext.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.