diff --git a/src/FSCache.js b/src/FSCache.js index a24de5954ad..8043b43e66f 100644 --- a/src/FSCache.js +++ b/src/FSCache.js @@ -4,7 +4,8 @@ const md5 = require('./utils/md5'); const objectHash = require('./utils/objectHash'); const pkg = require('../package.json'); const logger = require('./Logger'); -const {isGlob, glob} = require('./utils/glob'); +const glob = require('fast-glob'); +const isGlob = require('is-glob'); // These keys can affect the output, so if they differ, the cache should not match const OPTION_KEYS = ['publicURL', 'minify', 'hmr', 'target', 'scopeHoist']; @@ -34,9 +35,9 @@ class FSCache { async getLastModified(filename) { if (isGlob(filename)) { let files = await glob(filename, { - strict: true, - nodir: true + onlyFiles: true }); + return (await Promise.all( files.map(file => fs.stat(file).then(({mtime}) => mtime.getTime())) )).reduce((a, b) => Math.max(a, b), 0); diff --git a/src/utils/glob.js b/src/utils/glob.js deleted file mode 100644 index 8c04dfaa186..00000000000 --- a/src/utils/glob.js +++ /dev/null @@ -1,7 +0,0 @@ -const glob = require('glob'); -const promisify = require('./promisify'); - -exports.isGlob = function(filename) { - return /[*+{}]/.test(filename) && glob.hasMagic(filename); -}; -exports.glob = promisify(glob);