fix reducer that computes mtime for bundled file
authorDan Allen <dan@opendevise.com>
Wed, 11 Nov 2020 21:59:23 +0000 (14:59 -0700)
committerDan Allen <dan@opendevise.com>
Wed, 11 Nov 2020 21:59:23 +0000 (14:59 -0700)
gulp.d/tasks/build.js

index 7a5e929..f9e46ee 100644 (file)
@@ -76,7 +76,7 @@ module.exports = (src, dest, preview) => () => {
               })
               .bundle((bundleError, bundleBuffer) =>
                 Promise.all(mtimePromises).then((mtimes) => {
-                  const newestMtime = mtimes.reduce((max, curr) => (!max || curr > max ? curr : max))
+                  const newestMtime = mtimes.reduce((max, curr) => (curr > max ? curr : max), file.stat.mtime)
                   if (newestMtime > file.stat.mtime) file.stat.mtimeMs = +(file.stat.mtime = newestMtime)
                   if (bundleBuffer !== undefined) file.contents = bundleBuffer
                   file.path = file.path.slice(0, file.path.length - 10) + '.js'