Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): add #components alias to tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Aug 15, 2022
1 parent ff92446 commit 5e7a6b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/nuxt/src/components/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { statSync } from 'node:fs'
import { resolve } from 'pathe'
import { relative, resolve } from 'pathe'
import { defineNuxtModule, resolveAlias, addTemplate, addPluginTemplate } from '@nuxt/kit'
import type { Component, ComponentsDir, ComponentsOptions } from '@nuxt/schema'
import { componentsPluginTemplate, componentsTemplate, componentsTypeTemplate } from './templates'
Expand Down Expand Up @@ -137,7 +137,8 @@ export default defineNuxtModule<ComponentsOptions>({
context.components = newComponents
})

nuxt.hook('prepare:types', ({ references }) => {
nuxt.hook('prepare:types', ({ references, tsConfig }) => {
tsConfig.compilerOptions!.paths['#components'] = [relative(nuxt.options.rootDir, resolve(nuxt.options.buildDir, 'components'))]
references.push({ path: resolve(nuxt.options.buildDir, 'components.d.ts') })
})

Expand Down

0 comments on commit 5e7a6b5

Please sign in to comment.