From a418895595787976d789fcfd8a3addd0efbe6ca0 Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Thu, 8 Sep 2022 16:15:52 +0200 Subject: [PATCH] fix(kit): add default config layer without `nuxt.config` file (#7358) --- packages/kit/src/loader/config.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/kit/src/loader/config.ts b/packages/kit/src/loader/config.ts index b455cf2af3..ff7250a712 100644 --- a/packages/kit/src/loader/config.ts +++ b/packages/kit/src/loader/config.ts @@ -34,6 +34,17 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise 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 return applyDefaults(NuxtConfigSchema, nuxtConfig) as NuxtOptions }