From 4ee9c20b40e65b038ad5402adf0bf0c0290585bc Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Wed, 25 Apr 2018 23:57:02 -0400 Subject: [PATCH] use hash as key for maps --- atmosphere-packages/webpack/plugin.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/atmosphere-packages/webpack/plugin.js b/atmosphere-packages/webpack/plugin.js index 25c709c..84e4eae 100644 --- a/atmosphere-packages/webpack/plugin.js +++ b/atmosphere-packages/webpack/plugin.js @@ -14,7 +14,7 @@ Plugin.registerCompiler({ const { JSDOM } = Npm.require('jsdom'); - const compilerCache = {}; + const compilerCacheHashMap = {}; return { constructNewCompilerForTarget(targetPlatform, targetFile) { @@ -70,11 +70,11 @@ Plugin.registerCompiler({ //Get source hash in order to check if configuration is changed. const sourceHash = targetFile.getSourceHash(); //If source hash doesn't match the previous hash, clean the cache. - if(compilerCache.sourceHash !== sourceHash){ - compilerCache = { - sourceHash - }; - } + + compilerCacheHashMap[sourceHash] = compilerCacheHashMap[sourceHash] || {}; + + const compilerCache = compilerCacheHashMap[sourceHash]; + const targetPlatform = targetFile.getArch().includes('web') ? 'web' : 'node'; if (typeof compilerCache[targetPlatform] === 'undefined') {