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.

Tree Shakeable Injector

See original GitHub issue

Hey! Love the project, working great for me. However I’d like to be able to tree-shake my styles with my components. For instance, if I had 10 components, all 10 groups of styles would be injected even if only 3 components are used on a page.

I like the approach here where

<div className={style.myThing} />


<div className={style().myThing} />

Out of the box that package doesn’t work with rollup-plugin-styles. I’m trying to experiment with a custom injector to do it, but no luck just yet.

Is this something you’d consider adding as a built in option?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

garandcommented, Jun 26, 2020

Seems to be working just great so far. Will make additional issues later if I discover any functionality that is missing. Thanks for the hard work. 🙌

garandcommented, Jun 26, 2020

Already installed and trying it now. I’ll let you know if it’s doing what I expect!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TreeShakeableTokens - gists · GitHub
Tree -shakeable Tokens Docs. Status quo and issues with it. Injector structure. Currently, to provide services in Angular, you include them in an...
Read more >
Tree Shakable Services and Lightweight Injection Tokens ...
In this article we will discuss the concept of tree shaking and how angular handles tree shaking in general and specifically for services....
Read more >
Tree-shakable dependencies in Angular projects
The inject function injects dependencies from the module injector in which it's provided—in this example the root module injector. It can be ...
Read more >
Tree Shakeable Providers and Services in Angular - Cory Rylan
Let's look at an example of how we would have registered a Service in previous Angular versions to be used for dependency injection....
Read more >
How to build tree-shakeable JavaScript libraries - Cube Blog
In this tree-shakable implementation, dependency injection via Chart.register is used. Library code is very well split into individual parts ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found