Skip to content

Commit 70a7125

Browse files
committed
fix: made VirtualStats compatible with Node 6/8/10/12/14
VirtualStats was missing millisecond variables and incorrectly provided time value as milliseconds, when Node provides it as Date object.
1 parent 6f650f1 commit 70a7125

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/virtual.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ function VirtualModulesPlugin(compiler) {
4848

4949
VirtualModulesPlugin.prototype.writeModule = function(filePath, contents) {
5050
var len = contents ? contents.length : 0;
51-
var time = Date.now();
51+
var time = new Date();
52+
var timeMs = time.getTime();
5253

5354
var stats = new VirtualStats({
5455
dev: 8675309,
56+
mode: 33188,
5557
nlink: 0,
5658
uid: 1000,
5759
gid: 1000,
@@ -61,6 +63,10 @@ VirtualModulesPlugin.prototype.writeModule = function(filePath, contents) {
6163
mode: 33188,
6264
size: len,
6365
blocks: Math.floor(len / 4096),
66+
atimeMs: timeMs,
67+
mtimeMs: timeMs,
68+
ctimeMs: timeMs,
69+
birthtimeMs: timeMs,
6470
atime: time,
6571
mtime: time,
6672
ctime: time,

0 commit comments

Comments
 (0)