Skip to content

Commit

Permalink
use hash as key for maps
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Apr 26, 2018
1 parent 6b275fb commit 4ee9c20
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions atmosphere-packages/webpack/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Plugin.registerCompiler({
const {
JSDOM
} = Npm.require('jsdom');
const compilerCache = {};
const compilerCacheHashMap = {};
return {

constructNewCompilerForTarget(targetPlatform, targetFile) {
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit 4ee9c20

Please sign in to comment.