Skip to content

Commit

Permalink
fix: remove 404 handler
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed May 22, 2022
1 parent 70b9e41 commit 5506ae6
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions packages/vite/src/node/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,6 @@ export async function preview(
// apply post server hooks from plugins
postHooks.forEach((fn) => fn && fn())

if (!spa) {
// 404 handling (this simulates what most static hosts do)
app.use(config.base, (_, res, next) => {
const file = path.join(distDir, './404.html')
if (fs.existsSync(file)) {
res.statusCode = 404
res.end(fs.readFileSync(file))
} else {
next()
}
})
}

const options = config.preview
const hostname = resolveHostname(options.host)
const port = options.port ?? 4173
Expand Down

0 comments on commit 5506ae6

Please sign in to comment.