diff --git a/ets2panda/driver/build_system/src/build/base_mode.ts b/ets2panda/driver/build_system/src/build/base_mode.ts index e1d65f97f6fe1fe2db58868c9de4ba6bfe8dfc66..8aa06052726db66220a3a2409847536d72518756 100644 --- a/ets2panda/driver/build_system/src/build/base_mode.ts +++ b/ets2panda/driver/build_system/src/build/base_mode.ts @@ -612,7 +612,8 @@ export abstract class BaseMode { return; } for (const [packageName, moduleInfo] of this.moduleInfos) { - if (!file.startsWith(moduleInfo.moduleRootPath)) { + const relativePath = path.relative(moduleInfo.moduleRootPath, file); + if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) { continue; } if (moduleInfo.moduleType === OHOS_MODULE_TYPE.HAR && moduleInfo.byteCodeHar) {