Tree shakable component providers
See original GitHub issue🚀 feature request
Relevant Package
Description
I can tree shake components/directives, and module providers.
I want to tree shake component/directive providers, for services that are created per-component/directive.
Describe the solution you’d like
Perhaps providedIn: Component
? Not really sure.
Describe alternatives you’ve considered
No general solution that I know of.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Tree Shakeable Providers and Services in Angular - Cory Rylan
Angular recently introduced a new feature, Tree Shakeable Providers. Tree Shakeable Providers are a way to define services and other things ...
Read more >Tree-shakable dependencies in Angular projects
We've looked at modern options for configuring injectors with tree-shakable providers. Compared to the providers in the pre-Angular 6 era, tree- ...
Read more >What are Services and Tree Shakable providers in Angular ...
Services helps us to share common business logic, data and functions with different components of an Angular application. They are implemented through ...
Read more >Why are "providers" in components or modules not tree ...
If you use the providers way, then the application considers the service as a dependency and will not tree shake it.
Read more >The new Treeshakable Providers API in Angular
Treeshakable providers come with a new optional API that helps tools like webpack or rollup to get rid of unused services during the...
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
What I meant was that pre-Angular 6 we would have providers in Angular modules. That meant that there could be a reference to a service even without it actually being used in the application.
Using
Injectable
orInjectionToken
, we only have references to the dependencies if other dependencies or declarables (components, directives, and pipes) actually depend on them.So I’m simply trying to state how they make a difference for Angular projects. But you are probably already aware of this.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.