From d36bf551145c063dd4b30edec275e0ee07f4fe6a Mon Sep 17 00:00:00 2001 From: Joe Warrick Date: Mon, 20 Feb 2017 16:42:55 -0600 Subject: [PATCH] Include filename in hash of file. It is possible for two separate files to have the same contents but different data about the file, like path, what module it belongs to, etc. This includes the filename and the file contents in the hash that we calculate to determine uniqueness, so that different files with the same contents will be cached in different files. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 333643f..a3f065b 100644 --- a/index.js +++ b/index.js @@ -182,7 +182,7 @@ module.exports = function (folder, hash, log, disable) { if (doLog) doLog(err, false) return cb(err) } - var fileHash = createHash(fileData) + var fileHash = createHash(file + fileData) var cacheStart = hrtime() cacheFile = path.join(cachePrefix + '_' + fileHash + '.json') return readFile(cacheFile, 'utf8', function (_err, rawCacheData) {