mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): do not resolve non-absolute component paths (#29036)
This commit is contained in:
parent
ad78e7e63f
commit
215ae69192
@ -1,5 +1,5 @@
|
|||||||
import { existsSync, statSync, writeFileSync } from 'node:fs'
|
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 { addPluginTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, logger, resolveAlias, resolvePath, updateTemplates } from '@nuxt/kit'
|
||||||
import type { Component, ComponentsDir, ComponentsOptions } from 'nuxt/schema'
|
import type { Component, ComponentsDir, ComponentsOptions } from 'nuxt/schema'
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ export default defineNuxtModule<ComponentsOptions>({
|
|||||||
await nuxt.callHook('components:extend', newComponents)
|
await nuxt.callHook('components:extend', newComponents)
|
||||||
// add server placeholder for .client components server side. issue: #7085
|
// add server placeholder for .client components server side. issue: #7085
|
||||||
for (const component of newComponents) {
|
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
|
// attempt to resolve component path
|
||||||
component.filePath = await resolvePath(component.filePath, { fallbackToOriginal: true })
|
component.filePath = await resolvePath(component.filePath, { fallbackToOriginal: true })
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user