diff --git a/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts b/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts index 4aaaa150a3..58b698bc04 100644 --- a/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts +++ b/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts @@ -44,7 +44,7 @@ export class TargetedEntryPointFinder implements EntryPointFinder { private processNextPath(): void { const path = this.unprocessedPaths.shift() !; const entryPoint = this.getEntryPoint(path); - if (entryPoint !== null) { + if (entryPoint !== null && entryPoint.compiledByAngular) { this.unsortedEntryPoints.set(entryPoint.path, entryPoint); const deps = this.resolver.getEntryPointDependencies(entryPoint); deps.dependencies.forEach(dep => { diff --git a/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts b/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts index 351ed99bc8..73798eb746 100644 --- a/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts +++ b/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts @@ -121,6 +121,31 @@ runInEachFileSystem(() => { expect(entryPoints).toEqual([]); }); + // https://github.com/angular/angular/issues/32302 + it('should return an empty array if the target path is not an Angular entry-point with typings', + () => { + const targetPath = _Abs('/no_valid_entry_points/node_modules/some_package'); + loadTestFiles([ + { + name: _Abs('/no_valid_entry_points/node_modules/some_package/package.json'), + contents: '{"typings": "./index.d.ts"}' + }, + { + name: _Abs('/no_valid_entry_points/node_modules/some_package/index.d.ts'), + contents: 'export declare class MyClass {}' + }, + { + name: _Abs('/no_valid_entry_points/node_modules/some_package/index.js'), + contents: 'export class MyClass {}' + }, + ]); + const finder = new TargetedEntryPointFinder( + fs, config, logger, resolver, _Abs('/no_valid_entry_points/node_modules'), + targetPath, undefined); + const {entryPoints} = finder.findEntryPoints(); + expect(entryPoints).toEqual([]); + }); + it('should handle nested node_modules folders', () => { const targetPath = _Abs('/nested_node_modules/node_modules/outer'); loadTestFiles([ @@ -226,4 +251,4 @@ runInEachFileSystem(() => { }); }); -}); \ No newline at end of file +});