From 64b22c4806f0888f99081c322266d584d24fbed9 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 5 Jul 2018 12:50:51 +0200 Subject: [PATCH] make the cache a WeakMap to not leak memory fixes #6929 --- lib/optimize/SplitChunksPlugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index d56e2699399..60293603bf8 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -135,7 +135,8 @@ module.exports = class SplitChunksPlugin { static normalizeName({ name, automaticNameDelimiter }) { if (name === true) { - const cache = new Map(); + /** @type {WeakMap>} */ + const cache = new WeakMap(); const fn = (module, chunks, cacheGroup) => { let cacheEntry = cache.get(chunks); if (cacheEntry === undefined) {