Skip to content

fix(vite): preserve Vue plugin imports and canonical runtime bridge - #11555

Open
rafaelaugustos wants to merge 1 commit into
NativeScript:mainfrom
rafaelaugustos:fix/vite-vue-native-router
Open

rafaelaugustos wants to merge 1 commit into
NativeScript:mainfrom
rafaelaugustos:fix/vite-vue-native-router

Conversation

@rafaelaugustos

Copy link
Copy Markdown

PR Checklist

  • The PR title follows the contribution guidelines.
  • There is an issue for the bug/feature this PR is for.
  • You have signed the CLA.
  • All existing tests are passing (five existing environment-dependent failures reproduced on the unchanged base; details below).
  • Tests for the changes are included.

What is the current behavior?

Vue HMR rewrites dependencies whose names merely start with vue to /ns/rt, losing their exports. A per-module-served native plugin importing $navigateTo and ref from nativescript-vue can also receive duplicate helper bindings and the obsolete /ns/m/@nativescript/vendor.mjs URL.

What is the new behavior?

Match Vue runtime package boundaries and send the Vue strategy's framework imports directly to /ns/rt. Unrelated package imports retain their original destination, and the complete device transformation pipeline produces valid JavaScript for native navigation helpers.

Fixes #11554. Related to #11421; this does not claim to fix every dependency-routing case in that report.

Validation

  • Five regression cases failed before the patch. Nine regression cases now pass, including positive runtime prebundle cases and similarly named bare plugin imports.
  • nx run vite:test: 1,842 passed, five failed. All five failures are in typescript-optional.spec.ts, reporting The "paths[1]" argument must be of type string. Received undefined. Running that spec with both changed implementation files restored to base 3224f1b reproduces the same five failures (two passing).
  • nx format:write on changed files; git diff --check passes.
  • Original import failures observed on Android API 36 with published @nativescript/vite 8.0.19. The patch is verified through transformation tests, not a patched native package installation. Full file-routing native HMR remains separately blocked by the SFC assembler bypassing compile-time macro transforms. Bundled --no-hmr navigation is successful on iOS and Android with stock dependencies.

Manual follow-up: serve a linked plugin importing NativeScript-Vue navigation helpers through HTTP, then verify startup and a native push. Also verify an unrelated vue-* dependency keeps its own exports after optimization.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vite Vue HMR redirects similarly named packages and emits an obsolete vendor import

1 participant