mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -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:
parent
a8577278e0
commit
a156ecbb7f
2 changed files with 7 additions and 3 deletions
5
.changeset/kind-cameras-type.md
Normal file
5
.changeset/kind-cameras-type.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Warn about setting the `allowJs` compiler option only when the `content` directory exists.
|
|
@ -25,9 +25,6 @@ export async function attachContentServerListeners({
|
||||||
}: ContentServerListenerParams) {
|
}: ContentServerListenerParams) {
|
||||||
const contentPaths = getContentPaths(settings.config, fs);
|
const contentPaths = getContentPaths(settings.config, fs);
|
||||||
|
|
||||||
const maybeTsConfigStats = getTSConfigStatsWhenAllowJsFalse({ contentPaths, settings });
|
|
||||||
if (maybeTsConfigStats) warnAllowJsIsFalse({ ...maybeTsConfigStats, logging });
|
|
||||||
|
|
||||||
if (fs.existsSync(contentPaths.contentDir)) {
|
if (fs.existsSync(contentPaths.contentDir)) {
|
||||||
info(
|
info(
|
||||||
logging,
|
logging,
|
||||||
|
@ -36,6 +33,8 @@ export async function attachContentServerListeners({
|
||||||
contentPaths.contentDir.href.replace(settings.config.root.href, '')
|
contentPaths.contentDir.href.replace(settings.config.root.href, '')
|
||||||
)} for changes`
|
)} for changes`
|
||||||
);
|
);
|
||||||
|
const maybeTsConfigStats = getTSConfigStatsWhenAllowJsFalse({ contentPaths, settings });
|
||||||
|
if (maybeTsConfigStats) warnAllowJsIsFalse({ ...maybeTsConfigStats, logging });
|
||||||
await attachListeners();
|
await attachListeners();
|
||||||
} else {
|
} else {
|
||||||
viteServer.watcher.on('addDir', contentDirListener);
|
viteServer.watcher.on('addDir', contentDirListener);
|
||||||
|
|
Loading…
Reference in a new issue