From 71f1950c2e5fb264a894c19283838c7917eec67d Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Thu, 1 Aug 2024 14:50:17 +0100 Subject: [PATCH] Change from review --- packages/astro/src/content/vite-plugin-content-imports.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/content/vite-plugin-content-imports.ts b/packages/astro/src/content/vite-plugin-content-imports.ts index ce3d9638ce72..1a7deb99031f 100644 --- a/packages/astro/src/content/vite-plugin-content-imports.ts +++ b/packages/astro/src/content/vite-plugin-content-imports.ts @@ -156,8 +156,12 @@ export const _internal = { const entryType = getEntryType(entry, contentPaths, contentEntryExts, dataEntryExts); if (!COLLECTION_TYPES_TO_INVALIDATE_ON.includes(entryType)) return; + // The content config could depend on collection entries via `reference()`. // Reload the config in case of changes. - await reloadContentConfigObserver({ fs, settings, viteServer }); + // Changes to the config file itself are handled in types-generator.ts, so we skip them here + if (entryType === 'content' || entryType === 'data') { + await reloadContentConfigObserver({ fs, settings, viteServer }); + } // Invalidate all content imports and `render()` modules. // TODO: trace `reference()` calls for fine-grained invalidation.