Skip to content

Commit

Permalink
move static middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Sep 14, 2021
1 parent 4a89aa5 commit 0cdad1a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/gatsby/src/utils/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,6 @@ module.exports = {
res.end()
})

// Disable directory indexing i.e. serving index.html from a directory.
// This can lead to serving stale html files during development.
//
// We serve by default an empty index.html that sets up the dev environment.
app.use(developStatic(`public`, { index: false }))

const webpackDevMiddlewareInstance = webpackDevMiddleware(compiler, {
publicPath: devConfig.output.publicPath,
stats: `errors-only`,
Expand Down Expand Up @@ -477,6 +471,12 @@ module.exports = {
developMiddleware(app, program)
}

// Disable directory indexing i.e. serving index.html from a directory.
// This can lead to serving stale html files during development.
//
// We serve by default an empty index.html that sets up the dev environment.
app.use(developStatic(`public`, { index: false }))

// Set up API proxy.
const { proxy } = store.getState().config
if (proxy) {
Expand Down

0 comments on commit 0cdad1a

Please sign in to comment.