Skip to content

vite: /ns/m dev server 404s on pnpm-isolated transitive dependencies #11470

Closed

Description

@aleclarson

Build-time / dev-server error in @nativescript/vite (observed on 8.0.11, same code on main).

Description

Under pnpm's nodeLinker: isolated, a package's transitive dependency lives in that package's own node_modules (or .pnpm/.../node_modules/), not under the app root or the workspace root. The /ns/m module server only probes projectRoot and workspaceRoot (resolveCandidateFilePath in hmr/server/websocket-module-specifiers.ts), so requests for such files 404 and the dev-session boot fails:

Dynamic import error: Error: Instantiation failed (http-loader):
http://<host>:5173/ns/m/src/index.ts — HTTP import failed:
.../ns/m/node_modules/@nativescript-community/ui-image/... (network error)

Repro: a monorepo where an app imports a workspace package whose own dependency is a NativeScript plugin (e.g. @octane-xplat/gif → @nativescript-community/ui-image) — the app's node_modules contains no ui-image, so /ns/m/node_modules/@nativescript-community/ui-image/index-common.js can't resolve from either probed root.

Suggested fix

Probe each workspace package's node_modules directory (or use proper module resolution from the referring file's location) as a fallback before 404. In our tree, adding that fallback plus platform-suffixed candidates (.ios.js, .android.js) to the node_modules probe unblocked the whole module graph.

Environment: pnpm nodeLinker: isolated, @nativescript/vite 8.0.11, Vite 8.3, iOS simulator.

Activity

  1. aleclarson commented on Sep 28, 2026

    @aleclarson
    ContributorAuthor

    Minimal reproduction: https://github.com/aleclarson/repro/tree/nativescript-11470 — a single Node script (npm install && node repro.mjs) that exercises the exact upstream function/code path and prints the failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions