Skip to content

Commit d689fde

Browse files
Jasper De Moorfathyb
authored andcommitted
Get mtime of folder on wildcard imports (#1410)
1 parent 1e9556c commit d689fde

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/FSCache.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ class FSCache {
3434
// Write mtimes for each dependent file that is already compiled into this asset
3535
for (let dep of data.dependencies) {
3636
if (dep.includedInParent) {
37-
let stats = await fs.stat(dep.name);
37+
let depPath = dep.name;
38+
if (depPath[depPath.length - 1] === '*') {
39+
depPath = path.dirname(depPath);
40+
}
41+
let stats = await fs.stat(depPath);
3842
dep.mtime = stats.mtime.getTime();
3943
}
4044
}
@@ -47,7 +51,7 @@ class FSCache {
4751
await fs.writeFile(this.getCacheFile(filename), JSON.stringify(data));
4852
this.invalidated.delete(filename);
4953
} catch (err) {
50-
logger.error('Error writing to cache', err);
54+
logger.error(`Error writing to cache: ${err.message}`);
5155
}
5256
}
5357

@@ -83,7 +87,7 @@ class FSCache {
8387

8488
let json = await fs.readFile(cacheFile);
8589
let data = JSON.parse(json);
86-
if (!await this.checkDepMtimes(data)) {
90+
if (!(await this.checkDepMtimes(data))) {
8791
return null;
8892
}
8993

0 commit comments

Comments
 (0)