mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 09:25:54 +00:00
perf(nuxt): drop pathe
browser dep for deep server components (#30456)
This commit is contained in:
parent
7a5fd9b5f2
commit
7f49b6d573
@ -7,7 +7,6 @@ import { type ActiveHeadEntry, type Head, injectHead } from '@unhead/vue'
|
||||
import { randomUUID } from 'uncrypto'
|
||||
import { joinURL, withQuery } from 'ufo'
|
||||
import type { FetchResponse } from 'ofetch'
|
||||
import { join } from 'pathe'
|
||||
|
||||
import type { NuxtIslandResponse } from '../types'
|
||||
import { useNuxtApp, useRuntimeConfig } from '../nuxt'
|
||||
@ -37,7 +36,7 @@ async function loadComponents (source = appBaseURL, paths: NuxtIslandResponse['c
|
||||
for (const [component, item] of Object.entries(paths)) {
|
||||
if (!(components!.has(component))) {
|
||||
promises.push((async () => {
|
||||
const chunkSource = join(source, item.chunk)
|
||||
const chunkSource = joinURL(source, item.chunk)
|
||||
const c = await import(/* @vite-ignore */ chunkSource).then(m => m.default || m)
|
||||
components!.set(component, c)
|
||||
})())
|
||||
|
@ -3,6 +3,8 @@ import { Teleport, defineComponent, h, inject, provide, useId } from 'vue'
|
||||
import { useNuxtApp } from '../nuxt'
|
||||
// @ts-expect-error virtual file
|
||||
import { paths } from '#build/components-chunk'
|
||||
// @ts-expect-error virtual file
|
||||
import { buildAssetsURL } from '#internal/nuxt/paths'
|
||||
|
||||
type ExtendedComponent = Component & {
|
||||
__file: string
|
||||
@ -41,7 +43,7 @@ export default defineComponent({
|
||||
const name = (slotType.__name || slotType.name) as string
|
||||
|
||||
islandContext.components[to] = {
|
||||
chunk: import.meta.dev ? nuxtApp.$config.app.buildAssetsDir + paths[name] : paths[name],
|
||||
chunk: import.meta.dev ? buildAssetsURL(paths[name]) : paths[name],
|
||||
props: slot.props || {},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user