Skip to content

Commit

Permalink
refactor(nuxt): use pathe.join for layer lookup (nuxt#9540)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlexLichter authored Dec 6, 2022
1 parent 57d1b6d commit d0c0cd7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/nuxt/src/core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -136,7 +139,7 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
app.plugins = uniqueBy(await resolvePaths(app.plugins, 'src'), 'src')
}

function resolvePaths <Item extends Record<string, any>> (items: Item[], key: { [K in keyof Item]: Item[K] extends string ? K : never }[keyof Item]) {
function resolvePaths<Item extends Record<string, any>> (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 {
Expand Down

0 comments on commit d0c0cd7

Please sign in to comment.