diff --git a/.changeset/kind-cameras-type.md b/.changeset/kind-cameras-type.md new file mode 100644 index 0000000000..7b4621cd32 --- /dev/null +++ b/.changeset/kind-cameras-type.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Warn about setting the `allowJs` compiler option only when the `content` directory exists. \ No newline at end of file diff --git a/packages/astro/src/content/server-listeners.ts b/packages/astro/src/content/server-listeners.ts index 4631aa2bdd..52efc03314 100644 --- a/packages/astro/src/content/server-listeners.ts +++ b/packages/astro/src/content/server-listeners.ts @@ -25,9 +25,6 @@ export async function attachContentServerListeners({ }: ContentServerListenerParams) { const contentPaths = getContentPaths(settings.config, fs); - const maybeTsConfigStats = getTSConfigStatsWhenAllowJsFalse({ contentPaths, settings }); - if (maybeTsConfigStats) warnAllowJsIsFalse({ ...maybeTsConfigStats, logging }); - if (fs.existsSync(contentPaths.contentDir)) { info( logging, @@ -36,6 +33,8 @@ export async function attachContentServerListeners({ contentPaths.contentDir.href.replace(settings.config.root.href, '') )} for changes` ); + const maybeTsConfigStats = getTSConfigStatsWhenAllowJsFalse({ contentPaths, settings }); + if (maybeTsConfigStats) warnAllowJsIsFalse({ ...maybeTsConfigStats, logging }); await attachListeners(); } else { viteServer.watcher.on('addDir', contentDirListener);