cli
cli copied to clipboard
Nuxt listen hook HMR issue from 3.7.4
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
},
})
},
},
Additional context
Thanks for looking into this. If you require any more info, please let m eknow.
Logs
No response
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!
Updated reproduction to latest using npx nuxi upgrade --force. Same issue even when running with npx nuxi-edge@latest dev.
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.
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
Not an issue anymore from Nuxt 3.13.0. Closed #425 as well.