Skip to content

Commit 64bef2b

Browse files
authored
ensure custom 404 page shows after server restarts (#141)
1 parent ee891f7 commit 64bef2b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/index.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,20 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
197197
}
198198
})
199199

200-
if (exitHandlersBound) {
201-
return
202-
}
203-
204-
const clean = () => {
205-
if (fs.existsSync(pluginConfig.hotFile)) {
206-
fs.rmSync(pluginConfig.hotFile)
200+
if (! exitHandlersBound) {
201+
const clean = () => {
202+
if (fs.existsSync(pluginConfig.hotFile)) {
203+
fs.rmSync(pluginConfig.hotFile)
204+
}
207205
}
208-
}
209206

210-
process.on('exit', clean)
211-
process.on('SIGINT', process.exit)
212-
process.on('SIGTERM', process.exit)
213-
process.on('SIGHUP', process.exit)
207+
process.on('exit', clean)
208+
process.on('SIGINT', process.exit)
209+
process.on('SIGTERM', process.exit)
210+
process.on('SIGHUP', process.exit)
214211

215-
exitHandlersBound = true
212+
exitHandlersBound = true
213+
}
216214

217215
return () => server.middlewares.use((req, res, next) => {
218216
if (req.url === '/index.html') {

0 commit comments

Comments
 (0)