Skip to content

Commit

Permalink
fix(module): close dev server on nitro close (#1952)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored Mar 8, 2023
1 parent 327dad8 commit ee434ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,15 @@ export default defineNuxtModule<ModuleOptions>({

const ws = createWebSocket()

// Listen dev server
const { server, url } = await listen(() => 'Nuxt Content', options.watch.ws)

// Dispose storage on nuxt close
nitro.hooks.hook('close', async () => {
await ws.close()
await server.close()
})

// Listen dev server
const { server, url } = await listen(() => 'Nuxt Content', options.watch.ws)

server.on('upgrade', ws.serve)

// Register ws url
Expand Down

0 comments on commit ee434ef

Please sign in to comment.