From 277309765286aaff11c637540250e406e93ad6eb Mon Sep 17 00:00:00 2001 From: Igor Krestov Date: Fri, 4 Sep 2020 05:17:12 +0100 Subject: [PATCH] Make VirtualStats compatible with Node 6-14 (#125) --- lib/virtual.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/virtual.js b/lib/virtual.js index 7dec0eef..7e024665 100644 --- a/lib/virtual.js +++ b/lib/virtual.js @@ -48,19 +48,24 @@ function VirtualModulesPlugin(compiler) { VirtualModulesPlugin.prototype.writeModule = function(filePath, contents) { var len = contents ? contents.length : 0; - var time = Date.now(); + var time = new Date(); + var timeMs = time.getTime(); var stats = new VirtualStats({ dev: 8675309, + ino: inode++, + mode: 33188, nlink: 0, uid: 1000, gid: 1000, rdev: 0, - blksize: 4096, - ino: inode++, - mode: 33188, size: len, + blksize: 4096, blocks: Math.floor(len / 4096), + atimeMs: timeMs, + mtimeMs: timeMs, + ctimeMs: timeMs, + birthtimeMs: timeMs, atime: time, mtime: time, ctime: time,