From 215ae691929520bde1f38bd0382811ab5425c4ca Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 17 Sep 2024 16:57:02 +0200 Subject: [PATCH] fix(nuxt): do not resolve non-absolute component paths (#29036) --- packages/nuxt/src/components/module.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/components/module.ts b/packages/nuxt/src/components/module.ts index 9fa26f4ed4..34da7e1c71 100644 --- a/packages/nuxt/src/components/module.ts +++ b/packages/nuxt/src/components/module.ts @@ -1,5 +1,5 @@ import { existsSync, statSync, writeFileSync } from 'node:fs' -import { join, normalize, relative, resolve } from 'pathe' +import { isAbsolute, join, normalize, relative, resolve } from 'pathe' import { addPluginTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, logger, resolveAlias, resolvePath, updateTemplates } from '@nuxt/kit' import type { Component, ComponentsDir, ComponentsOptions } from 'nuxt/schema' @@ -169,7 +169,7 @@ export default defineNuxtModule({ await nuxt.callHook('components:extend', newComponents) // add server placeholder for .client components server side. issue: #7085 for (const component of newComponents) { - if (!(component as any /* untyped internal property */)._scanned && !(component.filePath in nuxt.vfs) && !existsSync(component.filePath)) { + if (!(component as any /* untyped internal property */)._scanned && !(component.filePath in nuxt.vfs) && isAbsolute(component.filePath) && !existsSync(component.filePath)) { // attempt to resolve component path component.filePath = await resolvePath(component.filePath, { fallbackToOriginal: true }) }