question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to disable sub entry points

See original GitHub issue

Type of Issue

[ ] Bug Report
[x] Feature Request

Description

As a library developer, I would like to have the possibility not to build sub entry points (for dev builds).

Details

We are experiencing build performance issues with our Angular library (30+ sub entries) even after migrating to Angular 10 (related to #1222).

lib build time (seconds) ng 8 non-Ivy (ng 10)
with sub-entries 194 90.93
without sub-entries 36 32.08

This is why we decided to have 2 separate builds:

  • a production one with sub-entries so that the library is tree-shaked
  • a development one without sub-entries - anindex.dev.ts barrel that exports the sub-entries.

In order allow both builds without chaing the code, we created a custom Angular builder that:

  1. generates package.json files for each sub-entry
  2. builds
  3. cleans-up previously generated package.json file.

Expected Behaviour

I would like to have a configuration flag so that ng-packagr ignores sub-entries. This way we can run ng-packagr for the dev build without the pre/post build processing.

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 10.1.0
@angular/compiler: 10.0.14
typescript: 3.9.7
rxjs: 6.6.3
node: 12.13.1
yarn: 1.21.1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
victorsccommented, Sep 30, 2020

Hi @SchnWalter

I generated a skeleton library and added 50 modules.

yarn && yarn run build // build time ~ 8 seconds
git checkout sub-entries && yarn run build // build time ~47 seconds
1reaction
SchnWaltercommented, Sep 30, 2020

From what I can tell, scheduleEntryPoints is creating a lot of class instances for each entry point. We might be able to reduce the resource usage and the build duration by reusing some of the instances, but this will be tricky when it comes to external packages like the mainNgcc process from @angular/compiler-cli/ngcc:

https://github.com/ng-packagr/ng-packagr/blob/2f470e0b7742b1a517ddd2bb33c603344c3294c5/src/lib/ngc/ngcc-processor.ts#L57-L65

For any change, we’ll need to make sure that we don’t introduce regressions and we’ll need to start adding benchmarks and tests. And we’ll need to check with the Angular Core team if the ngcc process can be reused, it probably can, because we have support for live-reload.

Read more comments on GitHub >

github_iconTop 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 >
How to only have secondary entry points in ng-packagr
I have an Angular CLI library where each component should only be imported through their individual entry-points (like Angular Material) :
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 >
Classes | Entry Point Wiki - Fandom
Operatives are able to select a second starting perk to become a hybrid class once they have enough perk points, which are obtained...
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found