fix(vite): alias vue through resolve.alias so the Vue flavor builds under rolldown - #11431
Merged
Merged
Conversation
…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
|
View your CI Pipeline Execution ↗ for commit 669ef2f
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
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?
vueConfigaliasesvuetonativescript-vuethrough@rollup/plugin-alias(enforce: 'pre'). With Vite 8 / rolldown the bare replacement resolves to the package directory, and every build fails on thefrom "vue"import that@vitejs/plugin-vueinjects into each SFC:An
exportsmap in nativescript-vue and thededupeentry inbase.tsdo 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. Theset-valueentry is dropped from the Vue layer becausebase.tsalready aliases it.configuration/vue.spec.tspins the shape.Verified with the repro from nativescript-vue/nativescript-vue#1160:
vite build -- --env.iosandns prepare iospass 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 runinpackages/vite: the only failures are the pre-existingtypescript-optional.spec.tscases, which need a built package.