Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dev): handle hard restart #147

Merged
merged 1 commit into from Sep 6, 2023
Merged

fix(dev): handle hard restart #147

merged 1 commit into from Sep 6, 2023

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Sep 6, 2023

resolves #135

hard restart support were missing in initial new dev server impl.

This PR also fixes small relevant issues:

  • avoid mutating process.argv (for subsequent reloads)
  • register (main) graceful shutdown hooks once
  • avoid exiting main process when child restarts with code 0 (internally by parent)

Playground: (WSS is buggy, need to rename playground/modules dir)

export default defineNuxtConfig({
  hooks: {
    ready(nuxt) {
      setTimeout(() => {
        console.log('sending hard restart...')
        nuxt.callHook('restart', { hard: true })
      }, 1000)
    },
  },
})

@pi0 pi0 merged commit b56169d into main Sep 6, 2023
2 checks passed
@pi0 pi0 deleted the fix/hard-restart branch September 6, 2023 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nuxt restart hook stop working in 3.7.0
1 participant