fix(vite): serve pnpm-isolated transitive deps over /ns/m - #11475
Merged
NathanWalker merged 2 commits intoSep 29, 2026
Merged
NathanWalker merged 2 commits into
NathanWalker merged 2 commits into
Conversation
|
View your CI Pipeline Execution ↗ for commit e2f49d3
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
- guard the workspace fallback against escaping its node_modules dir - probe pnpm's hoisted virtual store for deps of published packages - probe only the active platform suffix so iOS never picks .android.js - fix the spec's unterminated string literals - drop the resolveVendorRouting change duplicated from NativeScript#11459
NathanWalker
approved these changes
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What is the current behavior?
Under pnpm's
nodeLinker: isolated, a workspace package's own dependency lives in that package's privatenode_modules(e.g.packages/gif/node_modules/@nativescript-community/ui-image), not under the app root or the hoisted workspace root. Three compounding gaps make such deps unserveable over/ns/m:resolveCandidateFilePathonly probesprojectRootandworkspaceRoot, so the file lookup misses → 404.resolveVendorRoutingsends plugin-patterned package entries (e.g.ui-image'sindex.ios.jsmain) down thevendor:route even when the package isn't in the vendor manifest — the sync require then resolves to the missing-module stub instead of falling back to HTTP serving.createNsMRequestContext's candidate list never probes platform-suffixed files (index.ios.js), so a plugin'smain: './index'entry can't resolve at all in per-module serving.On device:
HTTP import failed/network errorduring dev-session boot. Repro with a real package set: any pnpm-isolated monorepo where an app imports a workspace package whose dependency is a NativeScript plugin.What is the new behavior?
resolveCandidateFilePathgains a cached, best-effort fallback that probes every workspace package'snode_modulesfor the<pkg>/<sub>tail of the URL (the importer is dropped by the URL form, so first-hit wins — pnpm guarantees the dep lives under exactly one package's private dir).resolveVendorRoutingonly takes thevendor:route for plugin-patterned packages when the package actually exists in the active vendor manifest; otherwise it falls through to the per-module HTTP path. A null manifest (early boot) keeps the legacy behavior.createNsMRequestContextexpands candidates with the active platform's suffixes (ios/android/visionos/native) before the unsuffixed variants — existence-filtered downstream, so probing is safe.Fixes #11470.
Testing note
Added
resolveCandidateFilePathspecs covering the pnpm-isolated hit, root priority, and the miss path. Verified end-to-end as a pnpm patch on 8.0.11: an app whose dev boot previously died on@nativescript-community/ui-imagenow serves the full module graph. Minimal standalone repro: https://github.com/aleclarson/repro/tree/nativescript-11470