mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
refactor(nuxt): use pathe.join
for layer lookup (#9540)
This commit is contained in:
parent
57d1b6d907
commit
d0c0cd7ad2
@ -60,7 +60,10 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
|
|||||||
// Resolve main (app.vue)
|
// Resolve main (app.vue)
|
||||||
if (!app.mainComponent) {
|
if (!app.mainComponent) {
|
||||||
app.mainComponent = await findPath(
|
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) {
|
if (!app.mainComponent) {
|
||||||
@ -136,7 +139,7 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
|
|||||||
app.plugins = uniqueBy(await resolvePaths(app.plugins, 'src'), 'src')
|
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) => {
|
return Promise.all(items.map(async (item) => {
|
||||||
if (!item[key]) { return item }
|
if (!item[key]) { return item }
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user