Skip to content

Commit

Permalink
Get mtime of folder on wildcard imports (#1410)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper De Moor authored and fathyb committed May 22, 2018
1 parent 1e9556c commit d689fde
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/FSCache.js
Expand Up @@ -34,7 +34,11 @@ class FSCache {
// Write mtimes for each dependent file that is already compiled into this asset
for (let dep of data.dependencies) {
if (dep.includedInParent) {
let stats = await fs.stat(dep.name);
let depPath = dep.name;
if (depPath[depPath.length - 1] === '*') {
depPath = path.dirname(depPath);
}
let stats = await fs.stat(depPath);
dep.mtime = stats.mtime.getTime();
}
}
Expand All @@ -47,7 +51,7 @@ class FSCache {
await fs.writeFile(this.getCacheFile(filename), JSON.stringify(data));
this.invalidated.delete(filename);
} catch (err) {
logger.error('Error writing to cache', err);
logger.error(`Error writing to cache: ${err.message}`);
}
}

Expand Down Expand Up @@ -83,7 +87,7 @@ class FSCache {

let json = await fs.readFile(cacheFile);
let data = JSON.parse(json);
if (!await this.checkDepMtimes(data)) {
if (!(await this.checkDepMtimes(data))) {
return null;
}

Expand Down

0 comments on commit d689fde

Please sign in to comment.