From 8ad5d89a15e4225650db75d4ad5bec9b4bb340f3 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 2 Nov 2021 09:38:32 +0000 Subject: [PATCH] fix(nuxt3): only add ref if types were generated (#1606) --- packages/nuxt3/src/components/module.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuxt3/src/components/module.ts b/packages/nuxt3/src/components/module.ts index d4676bd23a..dbdc8439ea 100644 --- a/packages/nuxt3/src/components/module.ts +++ b/packages/nuxt3/src/components/module.ts @@ -79,7 +79,9 @@ export default defineNuxtModule({ }) nuxt.hook('prepare:types', ({ references }) => { - references.push({ path: resolve(nuxt.options.buildDir, 'components.d.ts') }) + if (components.length) { + references.push({ path: resolve(nuxt.options.buildDir, 'components.d.ts') }) + } }) // Watch for changes