From 7021649bf8120f09c7099eeacddd7242d908ec58 Mon Sep 17 00:00:00 2001 From: Francisco Guerrero Date: Tue, 3 Sep 2024 19:11:34 +0200 Subject: [PATCH] test await --- src/module.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/module.ts b/src/module.ts index 90f612b..1949647 100644 --- a/src/module.ts +++ b/src/module.ts @@ -168,7 +168,7 @@ export default defineNuxtModule({ .replace(/^(~~|@@)/, nuxt.options.rootDir) .replace(/^(~|@)/, nuxt.options.srcDir) - const template = (() => { + const template = await (async () => { const resolvedFilename = `multiCache.serverOptions.ts` const maybeUserFile = fileExists(resolvedPath, extensions) @@ -182,15 +182,17 @@ export default defineNuxtModule({ ? `import * as importedServerOptions from '${relative(nuxt.options.buildDir, srcResolver(resolvedPath))}'` : `const importedServerOptions: MultiCacheServerOptions = {}` - return addTemplate({ - filename: resolvedFilename, - write: true, - getContents: () => ` + return await Promise.resolve( + addTemplate({ + filename: resolvedFilename, + write: true, + getContents: () => ` import type { MultiCacheServerOptions } from '${moduleTypesPath}' ${serverOptionsLine} -export const serverOptions = await Promise.resolve(importedServerOptions) +export const serverOptions = Promise.resolve(importedServerOptions) `, - }) + }), + ) })() nuxt.options.nitro.externals = nuxt.options.nitro.externals || {}