Skip to content

Commit 9fe2e61

Browse files
Sebastian WendorfSebastian Wendorf
authored andcommitted
Fixed resolution of imported module FQNs
1 parent 118ab5e commit 9fe2e61

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

typescript/src/core/processors/import-declaration.processor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export class ImportDeclarationProcessor extends Processor {
2727
let target = new FQN("");
2828
let isModule = false;
2929
if (specifier.type === AST_NODE_TYPES.ImportSpecifier) {
30-
const importSourceFqn = ModulePathUtils.toFQN(importSource);
30+
const importSourceFqn = ModulePathUtils.toFQN(NodeUtils.resolveImportPath(importSource, globalContext.projectInfo, globalContext.sourceFilePathAbsolute));
3131
const importedName = specifier.imported.type === AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.raw;
3232
target = new FQN(importSourceFqn.globalFqn + "." + importedName, importSourceFqn.localFqn + "." + importedName);
3333
} else if (specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier) {
34-
const importSourceFqn = ModulePathUtils.toFQN(importSource);
34+
const importSourceFqn = ModulePathUtils.toFQN(NodeUtils.resolveImportPath(importSource, globalContext.projectInfo, globalContext.sourceFilePathAbsolute));
3535
target = new FQN(importSourceFqn.globalFqn + ".default", importSourceFqn.localFqn + ".default");
3636
} else if (specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier) {
3737
target = new FQN(path.resolve(globalContext.projectInfo.rootPath, importSource), importSource);

typescript/src/core/utils/modulepath.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class ModulePathUtils {
202202
* @param modulePath absolute, relative, or node path
203203
* @param projectInfo ProjectInfo of the project that is currently being post-processed
204204
* @param projects list of all processed projects
205-
* @returns whether the path is outside the project (or one of its subprojects) or not
205+
* @returns whether the path is outside the project (and its subprojects) or not
206206
*/
207207
static isExternal(modulePath: string, projectInfo: LCEProjectInfo, projects: LCEProject[]): boolean {
208208
let moduleIndex: ModuleIndex | undefined = this.moduleIndexes.get(projectInfo.configPath);

0 commit comments

Comments
 (0)