Skip to content

Commit

Permalink
test await
Browse files Browse the repository at this point in the history
  • Loading branch information
fjguerrerorb committed Sep 3, 2024
1 parent aeb3959 commit 7021649
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default defineNuxtModule<ModuleOptions>({
.replace(/^(~~|@@)/, nuxt.options.rootDir)
.replace(/^(~|@)/, nuxt.options.srcDir)

const template = (() => {
const template = await (async () => {
const resolvedFilename = `multiCache.serverOptions.ts`

const maybeUserFile = fileExists(resolvedPath, extensions)
Expand All @@ -182,15 +182,17 @@ export default defineNuxtModule<ModuleOptions>({
? `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 || {}
Expand Down

0 comments on commit 7021649

Please sign in to comment.