mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
perf(kit): deduplicate layers before resolving config (#27582)
This commit is contained in:
parent
c2f2627b99
commit
d195930aae
@ -42,10 +42,15 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise<Nuxt
|
||||
nuxtConfig._nuxtConfigFiles = [configFile]
|
||||
|
||||
const _layers: ConfigLayer<NuxtConfig, ConfigLayerMeta>[] = []
|
||||
const processedLayers = new Set<string>()
|
||||
for (const layer of layers) {
|
||||
// Resolve `rootDir` & `srcDir` of layers
|
||||
layer.config = layer.config || {}
|
||||
layer.config.rootDir = layer.config.rootDir ?? layer.cwd
|
||||
layer.config.rootDir = layer.config.rootDir ?? layer.cwd!
|
||||
|
||||
// Only process/resolve layers once
|
||||
if (processedLayers.has(layer.config.rootDir)) { continue }
|
||||
processedLayers.add(layer.config.rootDir)
|
||||
|
||||
// Normalise layer directories
|
||||
layer.config = await applyDefaults(layerSchema, layer.config as NuxtConfig & Record<string, JSValue>) as unknown as NuxtConfig
|
||||
|
Loading…
Reference in New Issue
Block a user