From d0c0cd7ad2e854cb99411fb2d5191e4316248058 Mon Sep 17 00:00:00 2001 From: Alexander Lichter Date: Tue, 6 Dec 2022 12:30:14 +0100 Subject: [PATCH] refactor(nuxt): use `pathe.join` for layer lookup (#9540) --- packages/nuxt/src/core/app.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/core/app.ts b/packages/nuxt/src/core/app.ts index 95deb12f17..56fb6535da 100644 --- a/packages/nuxt/src/core/app.ts +++ b/packages/nuxt/src/core/app.ts @@ -60,7 +60,10 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) { // Resolve main (app.vue) if (!app.mainComponent) { app.mainComponent = await findPath( - nuxt.options._layers.flatMap(layer => [`${layer.config.srcDir}/App`, `${layer.config.srcDir}/app`]) + nuxt.options._layers.flatMap(layer => [ + join(layer.config.srcDir, 'App'), + join(layer.config.srcDir, 'app') + ]) ) } if (!app.mainComponent) { @@ -136,7 +139,7 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) { app.plugins = uniqueBy(await resolvePaths(app.plugins, 'src'), 'src') } -function resolvePaths > (items: Item[], key: { [K in keyof Item]: Item[K] extends string ? K : never }[keyof Item]) { +function resolvePaths> (items: Item[], key: { [K in keyof Item]: Item[K] extends string ? K : never }[keyof Item]) { return Promise.all(items.map(async (item) => { if (!item[key]) { return item } return {