cli icon indicating copy to clipboard operation
cli copied to clipboard

Nuxt listen hook HMR issue from 3.7.4

Open TechAkayy opened this issue 2 years ago • 2 comments

Environment

npx nuxi info

  • Operating System: Darwin
  • Node Version: v20.9.0
  • Nuxt Version: 3.8.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: hooks
  • Runtime Modules: -
  • Build Modules: -

Reproduction

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

Clone & install deps. Open nuxt.config.ts, and start dev-server.

Open start-up page in browser, and check console in both editor & browser

hooks: {
  listen: async (server, listener) => {
    addVitePlugin({
      name: 'live-designer',
      config: (config, {command, mode}) => {
        return config
      },
    })
  },
},

image

image

Additional context

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

Logs

No response

TechAkayy avatar Sep 26 '23 18:09 TechAkayy

Probably related to https://github.com/nuxt/cli/issues/247, HMR doesn't work anymore.

If anyone have any workaround for now, please share. Thanks!

TechAkayy avatar Oct 17 '23 03:10 TechAkayy

Updated reproduction to latest using npx nuxi upgrade --force. Same issue even when running with npx nuxi-edge@latest dev.

TechAkayy avatar Nov 30 '23 04:11 TechAkayy

Updated reproduction to latest (3.11) using npx nuxi upgrade --force, and manually updated package.json (for those changes to the starter template). Same issue even when running with npx nuxi-edge@latest dev.

Previously, attempt to connect to socket immediately got logged. But now, it doens't connect at all. This way HMR never gets activated.

After like some 4-5 mins, I see the error message both on the browser console as well as in the dev-server console. Previously it was instantly erroring out.

image

TechAkayy avatar Jun 04 '24 09:06 TechAkayy

Nuxt HMR doesn't like vite plugin added via addVitePlugin that returns the original config or merged config (using Vite's mergeConfig) in the config hook. Closing as explained in https://github.com/nuxt/cli/issues/425

TechAkayy avatar Jun 05 '24 10:06 TechAkayy

Not an issue anymore from Nuxt 3.13.0. Closed #425 as well.

TechAkayy avatar Aug 31 '24 02:08 TechAkayy