vuetify-nuxt-module
vuetify-nuxt-module copied to clipboard
Aliases don't seem to work when defined in blueprints
https://stackblitz.com/edit/nuxt-starter-5qj9ao?file=nuxt.config.ts
Defaults work, but components inside aliases have a Component is missing template or render function warning and don't render.
From a quick look at source code, I think it's because they don't get mapped to the components properly like the regular aliases config property.
Current hack solution
// vuetify.config.ts
...
blueprint: {
defaults: blueprint.defaults,
},
aliases: blueprint.aliases,
...
// blueprint.ts
import type { ComponentName } from 'vuetify-nuxt-module'
export default {
aliases: {
MyBtn: 'VBtn',
} as Record<string, ComponentName>,
...
}
Bonus tip for anyone dealing with Typescript and needing Intellisense on your virtual components:
declare module '@vue/runtime-dom' {
export interface GlobalComponents {
MyBtn: typeof import('vuetify/components')['VBtn']
}
}
Check the docs, you cannot use Vuetify blueprints, it has some limitations, I need to review the logic.
I'll check if I can register global aliases.
Check the docs, you cannot use Vuetify blueprints, it has some limitations, I need to review the logic.
I'll check if I can register global aliases.
According to the docs, you can use blueprints, though. https://vuetify-nuxt-module.netlify.app/guide/vuetify-blueprints.html
It says aliases can be used if used with string components. If this is not possible, the aliases option should be marked as unsupported.
Do you want me to close this? It has been a year and the docs are still the same.