Reverting manual component registration after Vuetify v3 migration
0 reputation · 17 Nov 2020, 01:56 UTC
0 reputation · 17 Nov 2020, 01:56 UTC
After upgrading a Vue 3 project from Vuetify v2 to v3, the migration tool removes manual component registration in favor of the vuetify-loader auto‑import plugin. The project contains legacy code that relies on explicit import statements and the global <v-app> wrapper, leading to a failed mount.
<v-app> requires a manual wrapper or fallback component that is not automatically generated.It is unclear whether the auto‑import plugin can be toggled back to manual mode, or if a custom plugin must be written to support legacy registration patterns.
vuetify-loader to revert to manual component registration after a v3 migration?<v-app> component in a Vuetify v3 project without rewriting the entire application?34775 reputation · 17 Nov 2020, 11:21 UTC
Vuetify v3 does not use vuetify-loader. The loader was a Vuetify v2 build‑time tool. In v3 auto‑import is optional and provided by unplugin-vue-components with the Vuetify resolver. Manual registration is still supported and is the default behavior when the resolver is not used. <v-app> is still required in v3.
createVuetify() plugin API. Components are registered globally by the plugin.<v-app> remains the root layout component in v3 and must wrap the application.vuetify-loader because the loader is not part of v3.The migration tool removed explicit imports and likely added an auto‑import resolver. Legacy code that expects explicit imports and a guaranteed <v-app> wrapper now mounts without the wrapper or with components not resolved, causing a failed mount.
If you use Vite:
// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [
vue(),
// remove or comment out Components() with Vuetify resolver
]
})
If you use Vue CLI/Webpack, remove the Components plugin from vue.config.js.
// plugins/vuetify.js
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
import 'vuetify/styles'
export default createVuetify({
components,
directives,
theme: {
defaultTheme: 'light'
}
})
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import vuetify from './plugins/vuetify'
createApp(App).use(vuetify).mount('#app')
Ensure App.vue contains the wrapper. No custom plugin is needed:
<template>
<v-app>
<router-view />
</v-app>
</template>
If legacy code relied on a global wrapper injected by the migration, add it once at the root.
Vuetify v3 uses CSS variables generated at runtime. Static CSS overrides can be preserved by loading them after Vuetify styles with higher specificity.
:root { --v-theme-primary: ... } overrides in a global CSS file imported after vuetify/styles.:where() to avoid being reset by the theme provider.createVuetify({ theme: { themes: { light: { colors: {...} } } } }) for long‑term stability.Note: !important can force legacy values but may break runtime theme switching.
package.json for vuetify@^3 and no vuetify-loader dependency.<v-app> renders and components work without auto‑import.One missing diagnostic that changes the recommendation: which build tool and plugin setup you currently have — Vite with unplugin-vue-components, Vue CLI with vue-cli-plugin-vuetify, or a custom Webpack config. The exact removal steps differ.
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 17 Nov 2020, 13:14 UTC
It is important to clarify that vuetify-loader was a Vuetify v2 build tool and is not part of Vuetify v3. In v3, manual component registration is actually the standard behavior. If components are missing or the app fails to mount, the issue typically stems from the plugin initialization rather than an auto-import setting.
To restore manual control and ensure <v-app> functions correctly, verify the following in your entry file (assuming Vuetify v3.x):
app.use(createVuetify()).components array to createVuetify({ components: [...] }) for global availability, or use standard ESM import statements within specific components.<v-app> is wrapping the root of your application; it remains a core requirement in v3 for layout and theme application.