mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(nuxt): add #components
alias to tsconfig (#6634)
This commit is contained in:
parent
e109d65c30
commit
8a28c430b0
@ -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'
|
||||
@ -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') })
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user