mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
feat(nuxt3): support async function as nuxt.config (#1612)
This commit is contained in:
parent
8838cc7192
commit
a8b969a4dd
@ -33,6 +33,11 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise<Nuxt
|
|||||||
|
|
||||||
if (nuxtConfigFile && existsSync(nuxtConfigFile)) {
|
if (nuxtConfigFile && existsSync(nuxtConfigFile)) {
|
||||||
nuxtConfig = requireModule(nuxtConfigFile, { clearCache: true })
|
nuxtConfig = requireModule(nuxtConfigFile, { clearCache: true })
|
||||||
|
|
||||||
|
if (typeof nuxtConfig === 'function') {
|
||||||
|
nuxtConfig = await nuxtConfig(opts)
|
||||||
|
}
|
||||||
|
|
||||||
nuxtConfig = { ...nuxtConfig }
|
nuxtConfig = { ...nuxtConfig }
|
||||||
nuxtConfig._nuxtConfigFile = nuxtConfigFile
|
nuxtConfig._nuxtConfigFile = nuxtConfigFile
|
||||||
nuxtConfig._nuxtConfigFiles = Array.from(scanRequireTree(nuxtConfigFile))
|
nuxtConfig._nuxtConfigFiles = Array.from(scanRequireTree(nuxtConfigFile))
|
||||||
|
Loading…
Reference in New Issue
Block a user