pmndrs / react-spring

✌️ A spring physics based React animation library
http://www.react-spring.dev/
MIT License
28.23k stars 1.19k forks source link

[bug]: Transpiling a file that imports useSpring and then using the transpiled build in another project gives error- TypeError: (0 , _web.useSpring) is not a function #2309

Closed Abhinandan-Kushwaha closed 1 month ago

Abhinandan-Kushwaha commented 3 months ago

Which react-spring target are you using?

What version of react-spring are you using?

9.7.4

What's Wrong?

Transpiling a file that imports useSpring using Babel makes the build unusable and throws following error - TypeError: (0 , _web.useSpring) is not a function

To Reproduce

  1. Make a react UI library that has a component say MyComponent which uses useSpring
  2. Export MyComponent from the library
  3. Build the library using Babel
  4. Import MyComponent in another react project

Expected Behaviour

Should not throw error

Link to repo

https://github.com/pmndrs/react-spring

ak-spotter commented 3 months ago

+1 facing the same issue

joshuaellis commented 3 months ago

This needs a reproduction before it can be looked at.