| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…age id Vite resolves a bare plugin import through the package's `exports` map to the concrete file before the rewriter sees it. For a NativeScript plugin with an `exports` map, `resolveInternalRuntimePluginBareSpecifier` kept that concrete subpath (`@scope/plugin/dist/index.js`) as the vendor id, which the device vendor registry (keyed on bare package ids) cannot serve; the import fell to the runtime's base require and came back as an empty placeholder module, so every named import was undefined. Consult the exports reverse map first and return the bare package id when the resolved file is the root export. Subpath exports still return null, package-internal files keep their concrete specifier, and main-field packages resolved to a platform file still fold through subpathMatchesMainEntry.
|
View your CI Pipeline Execution ↗ for commit c8108ec
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at 2026-09-02 22:52:12 UTC |
Sorry, something went wrong.
npm i https://pkg.pr.new/@nativescript/core@11411 npm i https://pkg.pr.new/@nativescript/vite@11411 npm i https://pkg.pr.new/@nativescript/webpack@11411 commit: c8108ec |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
resolveInternalRuntimePluginBareSpecifier decides which vendor id a NativeScript plugin import is served under on device. Vite resolves import { x } from '@scope/plugin' through the package's exports map to the concrete file (/node_modules/@scope/plugin/dist/index.js) before the rewriter sees it. For a plugin with an exports map the function then keeps that concrete subpath as the vendor id:
The device vendor registry is keyed on bare package ids, so __nsVendorRequire('@scope/plugin/dist/index.js') misses the deps bundle, falls to the runtime's base require and comes back as an empty placeholder module. Every named import is undefined and the app dies at the first call (registerElement is not a function). This is the same failure the subpathMatchesMainEntry comment describes for extensionless main fields, reached through the other package shape.
Fix
Consult the exports reverse map first: when the resolved file is what the package's root export points to, return the bare package id. Subpath exports still return null (left to the vendor resolver), package-internal files still keep their concrete specifier, and main-field packages resolved to a platform file (dist/index.ios.js) still fold through subpathMatchesMainEntry.