diff --git a/ace-loader/main.product.js b/ace-loader/main.product.js index f600d21..ddc0507 100644 --- a/ace-loader/main.product.js +++ b/ace-loader/main.product.js @@ -191,8 +191,9 @@ function compareCache(cachePath) { const cssFile = process.env.watchCSSFiles; let files = []; + let cssObject = {}; if (fs.existsSync(cssFile)) { - const cssObject = JSON.parse(fs.readFileSync(cssFile)); + cssObject = JSON.parse(fs.readFileSync(cssFile)); if (cssObject['clear'] === true) { deleteFolderRecursive(cachePath); return; @@ -212,6 +213,11 @@ function compareCache(cachePath) { if (!fs.existsSync(file)) { deleteFolderRecursive(cachePath); break; + } else if (cssObject['atime'] && cssObject['atime'][file]) { + if (cssObject['atime'][file] !== fs.statSync(file).atime.toString()) { + deleteFolderRecursive(cachePath); + break; + } } } }