From 047a52c1bd8cf5382f618261b9cc75f4b65e4517 Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Mon, 13 Feb 2023 17:58:25 -0500 Subject: [PATCH] fix: glob for single content extension --- .../astro/src/content/vite-plugin-content-virtual-mod.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts index ab69304b7..3a72bf1de 100644 --- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts +++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts @@ -24,7 +24,12 @@ export function astroContentVirtualModPlugin({ ); const contentEntryExts = getContentEntryExts(settings); - const entryGlob = `${relContentDir}**/*{${contentEntryExts.join(',')}}`; + const extGlob = + contentEntryExts.length === 1 + ? // Wrapping {...} breaks when there is only one extension + contentEntryExts[0] + : `{${contentEntryExts.join(',')}}`; + const entryGlob = `${relContentDir}**/*${extGlob}`; const virtualModContents = fsMod .readFileSync(contentPaths.virtualModTemplate, 'utf-8') .replace('@@CONTENT_DIR@@', relContentDir)