0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix(content-collections): warn about allowJs only when content directory exists (#6293)

* warn only when `content` directory exists

* chore: changeset
This commit is contained in:
Happydev 2023-02-18 14:24:33 +00:00 committed by GitHub
parent a8577278e0
commit a156ecbb7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Warn about setting the `allowJs` compiler option only when the `content` directory exists.

View file

@ -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);