Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aliases don't seem to work when defined in blueprints #160

Open
daniandl opened this issue Nov 19, 2023 · 2 comments
Open

Aliases don't seem to work when defined in blueprints #160

daniandl opened this issue Nov 19, 2023 · 2 comments

Comments

@daniandl
Copy link

daniandl commented Nov 19, 2023

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']
  }
}
@userquin
Copy link
Member

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.

@daniandl
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants