add warn message when using unsupported file types in pages/ (#6851)

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
This commit is contained in:
Timo Zander 2023-05-17 16:02:33 +02:00 committed by GitHub
parent c1669c0011
commit e9fc2c2213
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Added warning message when using unsupported file extensions in pages/

View file

@ -229,6 +229,8 @@ export function createRouteManifest(
const localFs = fsMod ?? nodeFs;
const isPrenderDefault = isHybridOutput(settings.config);
const foundInvalidFileExtensions: Set<string> = new Set();
function walk(
fs: typeof nodeFs,
dir: string,
@ -252,6 +254,11 @@ export function createRouteManifest(
}
// filter out "foo.astro_tmp" files, etc
if (!isDir && !validPageExtensions.has(ext) && !validEndpointExtensions.has(ext)) {
if (!foundInvalidFileExtensions.has(ext)) {
foundInvalidFileExtensions.add(ext);
warn(logging, 'astro', `Invalid file extension for Pages: ${ext}`);
}
return;
}
const segment = isDir ? basename : name;