From 1c62da4091324e6af0cdb38303605d759a7e553d Mon Sep 17 00:00:00 2001 From: yp9522 Date: Mon, 4 Aug 2025 17:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=BB=E9=99=A4module?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E9=85=8D=E7=BD=AE=EF=BC=8Cso=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E6=96=87=E4=BB=B6=E4=B8=8D=E6=9B=B4=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: https://gitee.com/openharmony/developtools_ace_ets2bundle/issues/ICR0SA Signed-off-by: yp9522 --- .../module/module_preload_file_utils.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/compiler/src/fast_build/ark_compiler/module/module_preload_file_utils.ts b/compiler/src/fast_build/ark_compiler/module/module_preload_file_utils.ts index a5915c829..c8d666070 100644 --- a/compiler/src/fast_build/ark_compiler/module/module_preload_file_utils.ts +++ b/compiler/src/fast_build/ark_compiler/module/module_preload_file_utils.ts @@ -135,17 +135,23 @@ export class PreloadFileModules { } } - private static deduplicateByName(entries: T[]): T[] { + private static deduplicateByName(entries: T[]): T[] { const seenNames = new Set(); - return entries - .map(({ moduleId, ...rest }) => rest) - .filter(entry => { - if (seenNames.has(entry.name)) { - return false; - } - seenNames.add(entry.name); - return true; - }); + return entries.filter(entry => { + if (!this.reCheckNeedPreloadSo(entry.moduleId)) { + return false; + } + if (seenNames.has(entry.name)) { + return false; + } + seenNames.add(entry.name); + return true; + }).map(({ moduleId, ...rest }) => rest); + } + + private static reCheckNeedPreloadSo(moduleId: string): boolean { + const metaModuleInfo: Object = this.rollupObject.getModuleInfo(moduleId); + return metaModuleInfo?.meta?.needPreloadSo ? metaModuleInfo?.meta?.needPreloadSo : false; } private static rollupModuleIds(): string[] { -- Gitee