Skip to content

Commit

Permalink
add default favicon to dev server, if none exists (#1177)
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott authored Oct 2, 2020
1 parent b50b123 commit e59ae05
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions snowpack/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,15 @@ export async function startServer(commandOptions: CommandOptions) {
const fileLoc = await getFileFromUrl(reqPath);

if (!fileLoc) {
const prefix = colors.red(' ✘ ');
logger.error(`[404] ${reqUrl}\n${attemptedFileLoads.map((loc) => prefix + loc).join('\n')}`);
const attemptedFilesMessage = attemptedFileLoads.map((loc) => ' ✘ ' + loc).join('\n');
const errorMessage = `[404] ${reqUrl}\n${attemptedFilesMessage}`;
// Log any favicon 404s at the "debug" level, only. Browsers automatically request a favicon.ico file
// from the server, which creates annoying errors for new apps / first experiences.
if (reqPath === '/favicon.ico') {
logger.debug(errorMessage);
} else {
logger.error(errorMessage);
}
return sendError(req, res, 404);
}

Expand Down

1 comment on commit e59ae05

@vercel
Copy link

@vercel vercel bot commented on e59ae05 Oct 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.