Skip to content

Commit

Permalink
fix: Add handler for favicon - causes slow response times
Browse files Browse the repository at this point in the history
It will hit the webpack dev server and assume its a url for react
  • Loading branch information
hofmeister committed Jan 6, 2024
1 parent fce8e64 commit 44281cf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 44281cf

Please sign in to comment.