How to use the resolveModuleName function from typescript

Find comprehensive JavaScript typescript.resolveModuleName code examples handpicked from public code repositorys.

163
164
165
166
167
168
169
170
171
172
  ts.isImportEqualsDeclaration(node) ||
  ts.isExportAssignment(node)
) {
  const moduleName = node.moduleSpecifier?.text;
  if (moduleName) {
    const resolvedModule = ts.resolveModuleName(
      moduleName,
      filePath,
      program.getCompilerOptions(),
      {
fork icon0
star icon0
watch icon1

+ 18 other calls in file

78
79
80
81
82
83
84
85
86
87
    continue;
}
if (decl.moduleSpecifier.kind !== ts.SyntaxKind.StringLiteral) {
    continue;
}
const resolvedModule = ts.resolveModuleName(decl.moduleSpecifier.text, refactor.fileName, program.getCompilerOptions(), host);
if (!resolvedModule.resolvedModule || !resolvedModule.resolvedModule.resolvedFileName) {
    continue;
}
const module = resolvedModule.resolvedModule.resolvedFileName;
fork icon0
star icon0
watch icon1

342
343
344
345
346
347
348
349
350
351
    // tslint:disable-next-line: no-console
    console.log(message);
}
resolveModuleNames(moduleNames, containingFile) {
    return moduleNames.map(moduleName => {
        const { resolvedModule } = ts.resolveModuleName(moduleName, utils_1.workaroundResolve(containingFile), this._options, this, this.moduleResolutionCache);
        if (this._options.enableIvy && resolvedModule && this.ngccProcessor) {
            this.ngccProcessor.processModule(moduleName, resolvedModule);
        }
        return resolvedModule;
fork icon0
star icon0
watch icon1

Other functions in typescript

Sorted by popularity

function icon

typescript.SyntaxKind is the most popular function in typescript (82777 examples)