Skip to content

Nuxt restart hook breaks HMR from 3.7.4 #231

@TechAkayy

Description

@TechAkayy

Environment

npx nuxi info

  • Operating System: Darwin
  • Node Version: v20.14.0
  • Nuxt Version: 3.13.0
  • CLI Version: 3.13.1
  • Nitro Version: 2.9.7
  • Package Manager: npm@10.7.0
  • Builder: -
  • User Config: modules, hooks, devtools
  • Runtime Modules: ()
  • Build Modules: -

Reproduction

https://github.com/TechAkayy/nuxt-374

I was testing the previous closed issue - #135

Clone & install deps. Open nuxt.config.ts, and start dev-server. After re-start in 12 secs, HMR breaks and the client loses connection with the server. Try uncommenting the div in app.vue, HMR is not applied anymore, loses connection with nuxt devtools too.

nuxt.hook('ready', async (nuxt) => {
  // Restart in 12 secs
  setTimeout(() => {
    console.log('Restarting in the 12 secs..')
    nuxt.callHook('restart', {hard: true})
  }, 12000)
})

image

Additional context

Thanks for looking into this. If you require any more info, please let m eknow.

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions