Skip to content

fix(vite): alias vue through resolve.alias so the Vue flavor builds under rolldown - #11431

Merged
NathanWalker merged 1 commit into
NativeScript:mainfrom
rigor789:fix/vite-vue-alias
Sep 14, 2026
Merged

NathanWalker merged 1 commit into
NativeScript:mainfrom
rigor789:fix/vite-vue-alias

Conversation

@rigor789

Copy link
Copy Markdown
Member

PR Checklist

What is the current behavior?

vueConfig aliases vue to nativescript-vue through @rollup/plugin-alias (enforce: 'pre'). With Vite 8 / rolldown the bare replacement resolves to the package directory, and every build fails on the from "vue" import that @vitejs/plugin-vue injects into each SFC:

[UNLOADABLE_DEPENDENCY] Could not load node_modules/nativescript-vue
 1 │ import { defineComponent as _defineComponent } from "vue";
   │                                                     ╰──── Is a directory (os error 21)

An exports map in nativescript-vue and the dedupe entry in base.ts do not change the outcome.

What is the new behavior?

The alias moves to Vite's resolve.alias ({ find: 'vue', replacement: 'nativescript-vue' }), which keeps the same exact-and-subpath matching and resolves the bare package correctly under rolldown. The set-value entry is dropped from the Vue layer because base.ts already aliases it. configuration/vue.spec.ts pins the shape.

Verified with the repro from nativescript-vue/nativescript-vue#1160: vite build -- --env.ios and ns prepare ios pass with this config, against both a local runtime and the published nativescript-vue 3.1.1.

Fixes #11429 (part 1; the HMR symlink problem in part 2 is #11430).

npx vitest run in packages/vite: the only failures are the pre-existing typescript-optional.spec.ts cases, which need a built package.

…nder rolldown

@rollup/plugin-alias resolved the bare `nativescript-vue` replacement to
the package directory under rolldown, so every SFC's injected `from "vue"`
failed the build with "Is a directory". Vite's own resolve.alias handles
the bare package. The set-value entry was already covered by base.ts.

Fixes NativeScript#11429
@nx-cloud

nx-cloud Bot commented Sep 14, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 669ef2f

Command Status Duration Result
nx run-many -t build -p core,webpack5,vite ✅ Succeeded 7s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-14 10:28:26 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11431
npm i https://pkg.pr.new/@nativescript/vite@11431
npm i https://pkg.pr.new/@nativescript/webpack@11431

commit: 669ef2f

@NathanWalker
NathanWalker merged commit 8dc3823 into NativeScript:main Sep 14, 2026
7 checks passed
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 flavor fails to build under rolldown and HMR breaks with a symlinked nativescript-vue

2 participants