Secondary Entry Points Multiple Subdirectories
See original GitHub issueType of Issue
[ ] Bug Report
[x] Feature Request
Description
Hello everyone, I want to add secondary entry points to our library but am running into path related issues searching for public_api.ts
. I want to clarify if using secondary entry points is applicable with this folder layout.
The library folder layout looks like this:
my_library
βββ projects
βββ my-package
βββ src
| βββ lib
| | βββ modules
| | | βββ my-module-one
| | | | βββ component
| | | | | βββ ...
| | | | βββ component
| | | | | βββ ...
| | | | βββ index.ts <--
| | | | βββ package.json <-- want to add these
| | | | βββ public-api.ts <--
| | | | βββ my-module-one.module.ts
| | | βββ my-module-two
| | | βββ component
| | | | βββ ...
| | | βββ component
| | | | βββ ...
| | | βββ index.ts <--
| | | βββ package.json <-- to each module that contains components
| | | βββ public-api.ts <--
| | | βββ my-module-two.module.ts
| | βββ index.ts
| | βββ package.json
| | βββ public-api.ts
| | βββ library.module.ts
| | βββ library.service.ts
| βββ public-api.ts (exports everything)
βββ ng-package.json (targets public-api above)
βββ tsconfig.lib.json
How To Reproduce
When building the first entry point will build with no issues (@name/my-package
).
Then the next entry point is @name/my-package/src/lib/modules/my-module-one
on which it fails with Cannot find module './public_api.ts'
Version Information
ng-packagr: 9.0.0
@angular/*: 9.1.9
typescript: ~3.8.3
rxjs: ~6.5.4
npm: 6.11.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Creating Secondary Entry Points for your Angular Library
In this article, we will take a look at how we can utilise ng-packagr secondary entry points to split our Angular Library even...
Read more >Building an Angular Library with multiple entry points | Articles
Then it's time to split the library into multiple entry points (known as secondary entry points or subentry points).
Read more >Angular library secondary entry points that depend on each ...
It happens that the secondary entry points are built BEFORE the main one, so having a shared logic, I will need to put...
Read more >Why and how to use secondary entrypoints in your Angular ...
By adding secondary entrypoints, we basically split our Angular libraries into multiple chunks, just like Angular Material does. A Example:.
Read more >Angular Libraries Adding Secondary EntryPoints - YouTube
This is the second part of Angular Libraries, where we add a secondary entrypoint to make Angular libraries Tree-shakable.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can have empty directories without a problem, but AFAIK this is NOT a documented feature and itβs NOT tested to prevent it from being removed in the future or to prevent regressions.
But you can always provide a minimal sub-package (or even a minimal root-package) that just exports something, you only need these files:
ng-package.json
public-api.ts
Effectively making the package an βemptyβ package.
Sub-package names include the relative path to the primary package; so, one can have an empty directory as parent for sub-packages and a structure like this example here will work just fine, but AFAIK itβs NOT a documented feature:
And you will have these packages, notice the missing entries for
/components
and/components/testing
sub-packages:If the library maintainers would like to make this a documented feature, I can quickly extend the tests to watch for these sub-packages that contain βempty directoriesβ in their name.
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.