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 @ which is required by @ doesn't exist. - yet the required entry point is free of outside imports beyond shared models and its folder

polonmedia opened this issue · comments

Type of Issue

[X] Bug Report
[ ] Feature Request

Description

Ok, so I reviewed already existing and closed issues regarding rootDir and still didnt grasp properly the concept. I know that the rootDir error comes from files out of library folders but I seem to have all the subfolders/entry points in one place, then still get the error. Mind you that Im reorganizing already existing big library of components.

How To Reproduce

My folder structure is like this
3 projects:
image

Only 1 is library:
image

I managed to set up different folders as different entry points, removed all circular dependency.
image

The main ng-pckgr.json and public-api seen above are like this so it covers the need for main entry file
image

Currently, each folder/entry point has its own public-api, ng-packgr etc, everything is correct and the files inside import files from other entry points via
image
(I think you call it "relative" paths)

I saw somewhere before that the imports may be the issue, so whenever i switch to
image
(absolute imports?)

I get:
image

What do?

Expected Behaviour

Well, I'd like for the subfolders/secondary entries to resolve their imports themselves as they are all part of one folder above them (with ng-packgr.json and public-api shown above). Or at least know from documentation how to handle such cases.
What is really out of rootDir here? Each entry point needs to be seperated from relative imports? How to manage the creation of entry points so they are created in a way that one can reference them in each other?

Version Information

$ node_modules/.bin/ng-packagr --version
"ng-packagr": "^16.0.0",
"@angular/": "^16.0.0",
"typescript": "~4.9.5",
"rxjs": "~6.5.5",
node: 16.4.0
npm/yarn: npm 8.3.1

Please include all version numbers that might be relevant, e.g. third-party libraries

In summary: my issue is i am modifying already existing library to have @lib/modal etc entry points instead of @lib;
I moved all the pretenders for secondary entry points to the main lib folder (deleted src/lib) everything is just flat. In this lib folder there are now multiple secondary entry points which reference each other. @lib/models is for example a sibling to @lib/modal but in the ts file I import via ../models not @lib/models as I cannot do it due to the error above, saying that those entry points do not exist yet. But when I leave the imports as is, I get the
image errors.

Are those siblings not part of the root library directory? I dont want to create more than one library for this, everything in the scope of @lib - so do I need to reexport those libraries in the main lib if theyd be created? This is how it's done?

This seems buggy, first I changed all my imports to absolute, no more rootDir as mentioned previously. I managed to get my @services to not import any other @sub-entry besides @models and themselves -> @models also do not import anything beyond themselves in their folder -> whenever i try to build i get:
image
What is the conditioning here? How the packager is determining which entry point is first? I want it to build @services and @models first, then it would all go away, but for some reason it just CANNOT

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.