From 2292827066fd36a07562713a4d73f3950d4e2800 Mon Sep 17 00:00:00 2001 From: hufeng Date: Tue, 6 Sep 2022 21:48:44 +0800 Subject: [PATCH] clear buildMapFileList after execute ark Signed-off-by: hufeng Change-Id: Ie62aa2ce3b3810b4fbdd6330a07d1fa736bef85f --- compiler/src/gen_abc_plugin.ts | 12 ++++++++---- compiler/src/gen_merged_abc.ts | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index 5f3f511..5b6e33f 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -151,9 +151,11 @@ export class GenAbcPlugin { // | --- es2abc -- debug -- not removeDir // | --- es2abc -- release -- removeDir // | --- ts2abc -- removeDir - if (projectConfig.compileMode === ESMODULE && ((projectConfig.buildArkMode !== 'debug' && process.env.panda === ES2ABC) || process.env.panda === TS2ABC)) { - removeDir(output); - removeDir(projectConfig.nodeModulesPath); + if (projectConfig.compileMode === ESMODULE) { + if ((projectConfig.buildArkMode !== 'debug' && process.env.panda === ES2ABC) || process.env.panda === TS2ABC) { + removeDir(output); + removeDir(projectConfig.nodeModulesPath); + } } compiler.hooks.compilation.tap('GenAbcPlugin', (compilation) => { @@ -205,8 +207,8 @@ function clearGlobalInfo() { // fix bug of multi trigger if (!process.env.watchMode) { intermediateJsBundle = []; - moduleInfos = []; } + moduleInfos = []; fileterIntermediateJsBundle = []; filterModuleInfos = []; commonJsModuleInfos = []; @@ -214,6 +216,7 @@ function clearGlobalInfo() { entryInfos = new Map(); hashJsonObject = {}; moduleHashJsonObject = {}; + buildMapFileList = []; } function getEntryInfo(tempFilePath: string, resourceResolveData: any): void { @@ -390,6 +393,7 @@ function handleFinishModules(modules, callback): any { updateCachedModuleList(buildMapFileList); } generateMergedAbc(moduleInfos, entryInfos); + clearGlobalInfo(); } else { judgeModuleWorkersToGenAbc(invokeWorkersModuleToGenAbc); processEntryToGenAbc(entryInfos); diff --git a/compiler/src/gen_merged_abc.ts b/compiler/src/gen_merged_abc.ts index cee7540..14d5ffe 100644 --- a/compiler/src/gen_merged_abc.ts +++ b/compiler/src/gen_merged_abc.ts @@ -35,9 +35,9 @@ const red: string = '\u001b[31m'; const reset: string = '\u001b[39m'; function generateCompileFilesInfo(moduleInfos: Array) { - const tempModuleInfos = Array(); + const tempModuleInfos: ModuleInfo[] = Array(); moduleInfos.forEach((item) => { - const check = tempModuleInfos.every((newItem) => { + let check: boolean = tempModuleInfos.every((newItem) => { return item.tempFilePath !== newItem.tempFilePath; }); if (check) {