From fc1126029b486bb2296214a8bcae2533a0d133e2 Mon Sep 17 00:00:00 2001 From: bojiang Date: Sat, 4 Nov 2023 11:02:56 +0800 Subject: [PATCH] jiangbo91@huawei.com Signed-off-by: bojiang Change-Id: I71275654b11c5a239a6ac74f9874713603bde568 --- ace-loader/src/compile-plugin.js | 6 ++++-- ace-loader/src/resource-plugin.js | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ace-loader/src/compile-plugin.js b/ace-loader/src/compile-plugin.js index 6e0dffd..1f71854 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 b2ee9fa..9b4656c 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) { -- Gitee