!797 support deccjsunit/index

Merge pull request !797 from houhaoyu/cherry-pick-1656918292
This commit is contained in:
openharmony_ci
2022-07-05 08:21:33 +00:00
committed by Gitee
+4
View File
@@ -148,8 +148,12 @@ function resolveModuleNames(moduleNames: string[], containingFile: string): ts.R
}
} else {
const modulePath: string = path.resolve(__dirname, '../../../api', moduleName + '.d.ts');
const suffix: string = /\.js$/.test(moduleName) ? '' : '.js';
const jsModulePath: string = path.resolve(__dirname, '../node_modules', moduleName + suffix);
if (ts.sys.fileExists(modulePath)) {
resolvedModules.push(getResolveModule(modulePath, '.d.ts'));
} else if (ts.sys.fileExists(jsModulePath)) {
resolvedModules.push(getResolveModule(modulePath, '.js'));
} else {
resolvedModules.push(null);
}