fix(kit): add default config layer without nuxt.config file (#7358)

This commit is contained in:
pooya parsa 2022-09-08 16:15:52 +02:00 committed by GitHub
parent d81a742311
commit a418895595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,17 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise<Nuxt
// Filter layers // Filter layers
nuxtConfig._layers = layers.filter(layer => layer.configFile && !layer.configFile.endsWith('.nuxtrc')) nuxtConfig._layers = layers.filter(layer => layer.configFile && !layer.configFile.endsWith('.nuxtrc'))
// Ensure at least one layer remains (without nuxt.config)
if (!nuxtConfig._layers.length) {
nuxtConfig._layers.push({
cwd,
config: {
rootDir: cwd,
srcDir: cwd
}
})
}
// Resolve and apply defaults // Resolve and apply defaults
return applyDefaults(NuxtConfigSchema, nuxtConfig) as NuxtOptions return applyDefaults(NuxtConfigSchema, nuxtConfig) as NuxtOptions
} }