Skip to content

Commit

Permalink
#62 Make current version part of cache key.
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinpeter committed Dec 7, 2017
1 parent b25af33 commit f3287ab
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/FSCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('./utils/fs');
const path = require('path');
const md5 = require('./utils/md5');
const objectHash = require('./utils/objectHash');
const pjson = require('../package.json');

// These keys can affect the output, so if they differ, the cache should not match
const OPTION_KEYS = ['publicURL', 'minify', 'hmr'];
Expand All @@ -10,8 +11,12 @@ class FSCache {
constructor(options) {
this.dir = path.resolve(options.cacheDir || '.cache');
this.dirExists = false;
this.invalidated = new Set;
this.optionsHash = objectHash(OPTION_KEYS.reduce((p, k) => (p[k] = options[k], p), {}));
this.invalidated = new Set();
this.optionsHash = objectHash(
OPTION_KEYS.reduce((p, k) => ((p[k] = options[k]), p), {
version: pjosn.version,
})
);
}

async ensureDirExists() {
Expand Down

0 comments on commit f3287ab

Please sign in to comment.