From 44281cf0768c20d6dbc15f9ea3099a0947586f48 Mon Sep 17 00:00:00 2001 From: Henrik Hofmeister Date: Sat, 6 Jan 2024 14:35:21 +0100 Subject: [PATCH] fix: Add handler for favicon - causes slow response times It will hit the webpack dev server and assume its a url for react --- src/webpack.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/webpack.ts b/src/webpack.ts index 53514a6..aee002c 100644 --- a/src/webpack.ts +++ b/src/webpack.ts @@ -60,6 +60,12 @@ export const applyWebpackHandlers = ( const webpackDevMiddleware = require('webpack-dev-middleware'); const compiler = webpack(devWebpackConfig); + app.get('/favicon.ico', (req, res) => { + // If no favicon is found here, return 404 + // This is to avoid the webpack dev middleware to return the index.html and taking a long time to respond + res.sendStatus(404).end(); + }); + app.use( '/', webpackDevMiddleware(compiler, {