Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree-shaking in v9 #1158

Closed
aleclarson opened this issue Sep 23, 2020 · 11 comments
Closed

Tree-shaking in v9 #1158

aleclarson opened this issue Sep 23, 2020 · 11 comments
Assignees
Labels
status: won't fix This will not be worked on

Comments

@aleclarson
Copy link
Contributor

aleclarson commented Sep 23, 2020

How does tree-shaking works in v9? It looks like I got the entire @react-spring in bundle no mater what I use. Is this expected behavior or did I miss something?

Originally posted by @jerry84 in #985 (comment)

OK, from my understanding @react-spring/core includes all the features that is possible to tree-shake before, for example color-interpolations. It doesn't look like it is possible anymore.

Originally posted by @jerry84 in #985 (comment)

@aleclarson
Copy link
Contributor Author

I plan on adding a Webpack-based tree-shaking demo to the v9 branch sometime soon. If anyone wants to contribute on that front, go right ahead. Then we can figure out if there's anything that needs to be fixed.

@jerry84
Copy link

jerry84 commented Sep 23, 2020

I plan on adding a Webpack-based tree-shaking demo to the v9 branch sometime soon. If anyone wants to contribute on that front, go right ahead. Then we can figure out if there's anything that needs to be fixed.

Thanks for the response, my assumption is at least correct 😄

@louisgv
Copy link

louisgv commented Oct 13, 2020

For the latest webpack + ts, it seems refactoring similar to #1150 will be needed.

@jacob-alford

This comment has been minimized.

@frenic
Copy link

frenic commented Apr 6, 2021

@joshuaellis Why was this closed and marked with wontfix?

@joshuaellis
Copy link
Member

@frenic because right now this isn't the priority of development, there are a fair few bugs and unification of the API to solve before that as well as updating the documentation.

However, if you're interested in working on this, then i'm happy to reopen and support you however I can? Would you like too?

@TheTrio
Copy link

TheTrio commented Jul 29, 2022

I'm working on an application where this is all we use from React Spring

const [y, setY] = useState(i * 75);
useSpring({
  y: i * 75,
  onChange(change) {
    setY(change.value.y);
  },
});

Do you have any idea how to make it so the entire package isn't included in the bundle? I know it might not be feasible for you all to implement tree shaking but I assume there's a different way to do this eliminating the need for React Spring altogether.

Thanks!

@itayganor
Copy link

@joshuaellis A year later, will this ever get on the roadmap?

@joshuaellis
Copy link
Member

Hi @itayganor, any particular reason you're asking? 😄

Unfortunately, react-spring isn't well contributed too – if you look at the history it's largely myself. I'm currently working on a new docs site right now for the project whilst fixing "critical" bugs. So, my capacity is rather tapped out. It could get on the roadmap and it would be great to do that, more importantly if there was a repo / env pre-setup to explore this that would aid me getting to it sooner.

@itayganor
Copy link

@joshuaellis I see. It's a great opportunity to thank you for your contributions for this magical library.

As for why I'm asking, it's because I just upgraded my app from v8 to v9 and I noticed an increased bundle size :\

@joshuaellis
Copy link
Member

@joshuaellis I see. It's a great opportunity to thank you for your contributions for this magical library.

As for why I'm asking, it's because I just upgraded my app from v8 to v9 and I noticed an increased bundle size :\

I think it could be the next large task to start investigating. The issue I worry about is how much of an architecture change it could cause, so it'd need to be handled as investigation before committing to development. I'll think about opening a new issue to track in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

8 participants