ng-packagr / ng-packagr

Compile and package Angular libraries in Angular Package Format (APF)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Entry point doesn't exist when imported library name starts with the name of importing library

montella1507 opened this issue · comments

Type of Issue

[x ] Bug Report

Description

We have 2 libraries:
"@company/a"
"@company/a/b"

Important info is, that library "a/b" IS NOT secondary entry point of A. They are only 2 standalone libraries.

However, during the build process, we have got error

Entry point @company/a/b which is required by @company/a doesn't exist.

I believe it is caused, because usually @company/a/b will be secondary entry point of @company/a so there is somewhere "check" that primary entry point, cannot import secondary entry point and in that case it throws the error...

There are lot of parts in ng-packagr code like
"moduleName.startsWith(${primaryModuleId}/)"

Expected Behaviour

Ng-packagr may not automatically takes libraries as secondary entry points based on their names only.

Version Information

ng-packagr:            16.1.0
@angular/compiler:     16.1.3
rollup:                3.26.0
typescript:            5.1.6

May be related to #1510 ?

Important info is, that library "a/b" IS NOT secondary entry point of A. They are only 2 standalone libraries.

Scoped package names can only contain a single slash in their name. Having multiple slashes implies secondary entry-points, by virtue of package names not allowing multiple slashes.

So it is by design? By whom, please?

The NPM docs describe:

The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can't contain any non-URL-safe characters.

A slash is a non-URL-safe character. Scoped package names are special in the sense that the slash is explicitly parsed, to extract a scope and package name from the singular name field.

Thanks. So it is basically not a bug, however the error message may be improved?

It is hard to debug and little-bit misleading as far as the A/B library exist and was successully built and all paths are correct?

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.