diff --git a/ace-loader/src/compile-plugin.js b/ace-loader/src/compile-plugin.js index 6e0dffd5215b2b77c12b5298eb4fd274778887e5..1f71854852463adc3dea60bd2f0e44efcd3e4dd3 100644 --- a/ace-loader/src/compile-plugin.js +++ b/ace-loader/src/compile-plugin.js @@ -178,11 +178,13 @@ function addCacheFiles(entryFile, cachePath, entryPaths) { oldArray.forEach(element => { entryPaths.add(element); }) - } else if (!(fs.existsSync(cachePath) && fs.statSync(cachePath).isDirectory())) { + } else if (!(process.env.tddMode === 'true') && !(fs.existsSync(cachePath) && fs.statSync(cachePath).isDirectory())) { mkDir(cachePath); } entryArray.push(...entryPaths); - fs.writeFileSync(entryFile, JSON.stringify(entryArray)); + if (fs.existsSync(cachePath) && fs.statSync(cachePath).isDirectory()) { + fs.writeFileSync(entryFile, JSON.stringify(entryArray)); + } } const red = '\u001b[31m'; diff --git a/ace-loader/src/resource-plugin.js b/ace-loader/src/resource-plugin.js index b2ee9fa0890d891f3e0acb153a39cd23db52cd52..9b4656cad5a1fd89e3a2a003ce1c7ee10ff8cf10 100644 --- a/ace-loader/src/resource-plugin.js +++ b/ace-loader/src/resource-plugin.js @@ -457,13 +457,16 @@ function readCSSInfo(watchCSSFiles) { } function writeCSSInfo(filePath, infoObject) { - if (!(fs.existsSync(path.resolve(filePath, '..')) && fs.statSync(path.resolve(filePath, '..')).isDirectory())) { + if (!(process.env.tddMode === 'true') && !(fs.existsSync(path.resolve(filePath, '..')) && + fs.statSync(path.resolve(filePath, '..')).isDirectory())) { mkDir(path.resolve(filePath, '..')); } if (fs.existsSync(filePath)) { fs.unlinkSync(filePath); } - fs.writeFileSync(filePath, JSON.stringify(infoObject, null, 2)); + if (fs.existsSync(path.resolve(filePath, '..')) && fs.statSync(path.resolve(filePath, '..')).isDirectory()) { + fs.writeFileSync(filePath, JSON.stringify(infoObject, null, 2)); + } } function setCSSEntry(cssfiles, key) {