From e8a3f09205a3e16d3d41c34145457236b99b766e Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sun, 20 Jul 2025 13:07:45 +0200 Subject: [PATCH] fix(dev): only close config watchers when process exits --- packages/nuxi/src/dev/utils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/nuxi/src/dev/utils.ts b/packages/nuxi/src/dev/utils.ts index edc360cdf..2953498e1 100644 --- a/packages/nuxi/src/dev/utils.ts +++ b/packages/nuxi/src/dev/utils.ts @@ -181,6 +181,11 @@ export class NuxtDevServer extends EventEmitter { async init() { await this.load() this._watchConfig() + + process.on('exit', () => { + this._distWatcher?.close() + this._configWatcher?.() + }) } async load(reload?: boolean, reason?: string) { @@ -198,8 +203,6 @@ export class NuxtDevServer extends EventEmitter { } async close() { - this._distWatcher?.close() - this._configWatcher?.() if (this._currentNuxt) { await this._currentNuxt.close() }