React-spring: Tree-shaking in v9

Created on 23 Sep 2020  路  4Comments  路  Source: pmndrs/react-spring

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 https://github.com/pmndrs/react-spring/issues/985#issuecomment-697275104_

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 https://github.com/pmndrs/react-spring/issues/985#issuecomment-697288923_

question v9

Most helpful comment

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.

All 4 comments

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.

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 馃槃

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

What's the status of this issue? I just upgraded to v9.0.0-rc.3, and now I'm getting this error with our Jest tests:
TypeError: (0 , _reactSpring.useSpring) is not a function

We're using Create React App, with Typescript. Any file that imports anything from react-spring, i.e.
import { useSpring } from 'react-spring' is effected.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VincentCtr picture VincentCtr  路  3Comments

eDubrovsky picture eDubrovsky  路  3Comments

localjo picture localjo  路  3Comments

jmcruzmanalo picture jmcruzmanalo  路  4Comments

chuckdries picture chuckdries  路  3Comments