From e9fc2c2213036d47cd30a47a6cdad5633481a0f8 Mon Sep 17 00:00:00 2001 From: Timo Zander Date: Wed, 17 May 2023 16:02:33 +0200 Subject: [PATCH] add warn message when using unsupported file types in pages/ (#6851) Co-authored-by: Nate Moore Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> --- .changeset/hip-bottles-hide.md | 5 +++++ packages/astro/src/core/routing/manifest/create.ts | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/hip-bottles-hide.md diff --git a/.changeset/hip-bottles-hide.md b/.changeset/hip-bottles-hide.md new file mode 100644 index 000000000000..d8564ab649e9 --- /dev/null +++ b/.changeset/hip-bottles-hide.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Added warning message when using unsupported file extensions in pages/ diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index 47282210990a..51f495e8b468 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -229,6 +229,8 @@ export function createRouteManifest( const localFs = fsMod ?? nodeFs; const isPrenderDefault = isHybridOutput(settings.config); + const foundInvalidFileExtensions: Set = 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;