From 4c808c90ab7541c7b341f8ac2a225f4f9fca2f98 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Wed, 22 Nov 2017 12:51:07 +0300 Subject: [PATCH] fix memory leak on restart nuxt-dev (#2190) --- lib/builder/builder.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/builder/builder.js b/lib/builder/builder.js index a63e46950c..9427a41c2d 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -449,10 +449,16 @@ export default class Builder { return } // Server, build and watch for changes - compiler.watch(this.options.watchers.webpack, (err) => { + const watching = compiler.watch(this.options.watchers.webpack, (err) => { /* istanbul ignore if */ if (err) return reject(err) }) + + // Stop watching on nuxt.close() + this.nuxt.hook('close', () => { + watching.close() + }) + return } // --- Production Build ---