diff options
author | 2023-02-18 14:24:33 +0000 | |
---|---|---|
committer | 2023-02-18 09:24:33 -0500 | |
commit | a156ecbb7f4df6a46124a9a12eb712f9163db2ed (patch) | |
tree | ae6fbe7f8dc3d937c2480ff26a54d7eccea6b71f | |
parent | a8577278e0a5dca0e6c358e028448bbcac8e2ead (diff) | |
download | astro-a156ecbb7f4df6a46124a9a12eb712f9163db2ed.tar.gz astro-a156ecbb7f4df6a46124a9a12eb712f9163db2ed.tar.zst astro-a156ecbb7f4df6a46124a9a12eb712f9163db2ed.zip |
fix(content-collections): warn about `allowJs` only when `content` directory exists (#6293)
* warn only when `content` directory exists
* chore: changeset
-rw-r--r-- | .changeset/kind-cameras-type.md | 5 | ||||
-rw-r--r-- | packages/astro/src/content/server-listeners.ts | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/.changeset/kind-cameras-type.md b/.changeset/kind-cameras-type.md new file mode 100644 index 000000000..7b4621cd3 --- /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 4631aa2bd..52efc0331 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); |