vuetifyjs / vuetifyjs/nuxt-module

Aliases don't seem to work when defined in blueprints

Open
#160 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: config bug priority: p3: medium
Dominant language
TypeScript
Stars
286
Forks
35
Avg merge
5d 21h
Merged PRs (30d)
4

Description

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']
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the StackBlitz reproduction and inspect nuxt.config.ts, vuetify.config.ts, and blueprint.ts, comparing blueprint aliases with the regular aliases configuration. Trace how aliases are mapped to components and verify the result by rendering MyBtn without the workaround; done means blueprint-defined aliases render without the missing-template warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.