refactor(ngcc): resolve modules based on the provided moduleResolver
(#34494)
The `DependencyHost` implementations were duplicating the "postfix" strings which are used to find matching paths when resolving module specifiers. Now the hosts reuse the postfixes given to the `ModuleResolver` that is passed to the host. PR Close #34494
This commit is contained in:

committed by
Alex Rickabaugh

parent
8573677528
commit
fa43184c0f
@ -39,7 +39,7 @@ export abstract class DependencyHostBase implements DependencyHost {
|
||||
collectDependencies(
|
||||
entryPointPath: AbsoluteFsPath, {dependencies, missing, deepImports}: DependencyInfo): void {
|
||||
const resolvedFile =
|
||||
resolveFileWithPostfixes(this.fs, entryPointPath, ['', '.js', '/index.js']);
|
||||
resolveFileWithPostfixes(this.fs, entryPointPath, this.moduleResolver.relativeExtensions);
|
||||
if (resolvedFile !== null) {
|
||||
const alreadySeen = new Set<AbsoluteFsPath>();
|
||||
this.recursivelyCollectDependencies(
|
||||
|
@ -24,7 +24,7 @@ import {PathMappings, isRelativePath, resolveFileWithPostfixes} from '../utils';
|
||||
export class ModuleResolver {
|
||||
private pathMappings: ProcessedPathMapping[];
|
||||
|
||||
constructor(private fs: FileSystem, pathMappings?: PathMappings, private relativeExtensions = [
|
||||
constructor(private fs: FileSystem, pathMappings?: PathMappings, readonly relativeExtensions = [
|
||||
'', '.js', '/index.js'
|
||||
]) {
|
||||
this.pathMappings = pathMappings ? this.processPathMappings(pathMappings) : [];
|
||||
|
Reference in New Issue
Block a user