Skip to content

Commit

Permalink
add warn message when using unsupported file types in pages/ (#6851)
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
  • Loading branch information
3 people committed May 17, 2023
1 parent c1669c0 commit e9fc2c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-bottles-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Added warning message when using unsupported file extensions in pages/
7 changes: 7 additions & 0 deletions packages/astro/src/core/routing/manifest/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit e9fc2c2

Please sign in to comment.