From 5e7a6b514ba41899bcb7c7f64edc7ee9c459673f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 15 Aug 2022 12:23:27 +0100 Subject: [PATCH] fix(nuxt): add `#components` alias to tsconfig --- packages/nuxt/src/components/module.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/components/module.ts b/packages/nuxt/src/components/module.ts index 56169b112b9..51fea129d02 100644 --- a/packages/nuxt/src/components/module.ts +++ b/packages/nuxt/src/components/module.ts @@ -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({ 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') }) })