diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index a56cd183dfe26c695fc50a7f6c6cfcc859218070..e1f19b2e03981622dbd64a2c8e5278e7f2c98708 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -769,6 +769,9 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent [...allResolvedModules, ...rootFileNames].forEach(moduleFile => { if (!(moduleFile.match(new RegExp(projectConfig.packageDir)) && projectConfig.compileHar)) { try { + if (toUnixPath(moduleFile).includes('/oh_modules/')) { + return; + } if ((/\.d\.e?ts$/).test(moduleFile)) { generateSourceFilesInHar(moduleFile, fs.readFileSync(moduleFile, 'utf-8'), path.extname(moduleFile), projectConfig, projectConfig.modulePathMap); @@ -790,9 +793,13 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent } function printDeclarationDiagnostics(errorCodeLogger?: Object | undefined): void { - globalProgram.builderProgram.getDeclarationDiagnostics().forEach((diagnostic: ts.Diagnostic) => { + globalProgram.builderProgram.getSourceFiles().forEach((sourceFile: ts.SourceFile) => { + if (toUnixPath(sourceFile.fileName).includes('/oh_modules/')) { + return; + } + const diagnostic: ts.Diagnostic = globalProgram.builderProgram.getDeclarationDiagnostics(sourceFile); printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); - }); + }) } function containFormError(message: string): boolean { diff --git a/compiler/src/interop/src/ets_checker.ts b/compiler/src/interop/src/ets_checker.ts index cf94e38281031a819f50d13aa3254f285718d9d6..244f21295c2496f4bac9b2f830ddaf529eabf4cd 100644 --- a/compiler/src/interop/src/ets_checker.ts +++ b/compiler/src/interop/src/ets_checker.ts @@ -789,6 +789,9 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent [...allResolvedModules, ...rootFileNames].forEach(moduleFile => { if (!(moduleFile.match(new RegExp(projectConfig.packageDir)) && projectConfig.compileHar)) { try { + if (toUnixPath(moduleFile).includes('/oh_modules/')) { + return; + } if ((/\.d\.e?ts$/).test(moduleFile)) { generateSourceFilesInHar(moduleFile, fs.readFileSync(moduleFile, 'utf-8'), path.extname(moduleFile), projectConfig, projectConfig.modulePathMap); @@ -810,9 +813,13 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent } function printDeclarationDiagnostics(errorCodeLogger?: Object | undefined): void { - globalProgram.builderProgram.getDeclarationDiagnostics().forEach((diagnostic: ts.Diagnostic) => { + globalProgram.builderProgram.getSourceFiles().forEach((sourceFile: ts.SourceFile) => { + if (toUnixPath(sourceFile.fileName).includes('/oh_modules/')) { + return; + } + const diagnostic: ts.Diagnostic = globalProgram.builderProgram.getDeclarationDiagnostics(sourceFile); printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); - }); + }) } function containFormError(message: string): boolean {