fix(vite-dev): replace default Vue
import with named
#723
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.
π Linked issue
Closes: #583
β Type of change
This commit fixes an issue where the default Vue import in Vite was undefined in development mode. To solve this issue, the commit creates Vite transformation plugin, running only in dev mode. It looks for default import and replaces with named. Also it adds named
Vue
export to the vue dist files.π Description
I've created 2 sandboxes with and without "patch"
Since
Nuxt Bridge
requiresNuxt 2.16
, andNuxt 2.16
running withVue 2.7
, which is the last minor version of Vue 2, I suppose we can rely on paths of vue dists (vue/dist/vue.runtime.esm.js/mjs) for "patching" them. However we can extend the list of possible files for patching and check if they have default exportI have some difficulties with writing a tests for this fix, because original issue happens only in client dev, but mannually tested with vue-demi, portal-vue, vuetify. I can also add Portal-vue integration in this PR, but I'm not sure about it
π Checklist