fix(dev): clearnup vue installed plugins from server in dev mode (#8697)

This commit is contained in:
Xin Du (Clark) 2021-01-27 10:26:08 +00:00 committed by GitHub
parent 0bcbaacfa6
commit dc551f9709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,24 @@ if (!Vue.__nuxt__fetch__mixin__) {
} }
<% } %> <% } %>
<% if (isDev) { %>
if (!Vue.__original_use__) {
Vue.__original_use__ = Vue.use
Vue.__install_times__ = 0
Vue.use = function (plugin, ...args) {
plugin.__nuxt_external_installed__ = Vue._installedPlugins.includes(plugin)
return Vue.__original_use__(plugin, ...args)
}
}
if (Vue.__install_times__ === 2) {
Vue.__install_times__ = 0
Vue._installedPlugins = Vue._installedPlugins.filter(plugin => {
return plugin.__nuxt_external_installed__ === true
})
}
Vue.__install_times__++
<% } %>
// Component: <NuxtLink> // Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink) Vue.component(NuxtLink.name, NuxtLink)
<% if (features.componentAliases) { %>Vue.component('NLink', NuxtLink)<% } %> <% if (features.componentAliases) { %>Vue.component('NLink', NuxtLink)<% } %>