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

[bug]: Cannot find module '@react-spring/rafz' #2173

Closed
1 task done
everdimension opened this issue Jul 4, 2023 · 9 comments
Closed
1 task done

[bug]: Cannot find module '@react-spring/rafz' #2173

everdimension opened this issue Jul 4, 2023 · 9 comments
Labels
kind: bug Something isn't working type: good first issue Good for newcomers

Comments

@everdimension
Copy link

everdimension commented Jul 4, 2023

Which react-spring target are you using?

  • @react-spring/web

What version of react-spring are you using?

9.7.3

What's Wrong?

I am having an issue similar to #1559

I am using parcel to build my project. I am seeing this type warning:

node_modules/@react-spring/shared/dist/react-spring_shared.modern.d.ts:1:27 - error TS2307: Cannot find module '@react-spring/rafz' or its corresponding type declarations.

1 import { raf, Rafz } from '@react-spring/rafz';

To Reproduce

npm i @react-spring/web
... later in project ...
import { useSpring } from '@react-spring/web';

I can see that @react-spring/rafz is not in my node_modules, but in fact it's being used by @react-spring/shared package:
image

Expected Behaviour

I think @react-spring/rafz is expected to be installed along with @react-spring/web

Link to repo

@everdimension everdimension added the template: bug This issue might be a bug label Jul 4, 2023
@joshuaellis
Copy link
Member

Can you share a reproduction of this please

@joshuaellis joshuaellis added the type: needs repro Needs minimal reproduction label Jul 4, 2023
@everdimension
Copy link
Author

Sure!

Turns out this wasn't a parcel issue, but a tsc issue

Here's the reproduction repo: https://github.com/everdimension/react-spring-raf-repro

@joshuaellis joshuaellis added kind: bug Something isn't working type: good first issue Good for newcomers and removed type: needs repro Needs minimal reproduction template: bug This issue might be a bug labels Jul 4, 2023
@cherishs001
Copy link

cherishs001 commented Jul 6, 2023

I had the same problem, and I solved it temporarily by manually installing @react-spring/rafz, it looks like the @react-spring/rafz dependency is missing from the @react-spring/shared package

@mateusvelleda
Copy link

actually it was introduced at 9.7.0

@rangaraju29139
Copy link

rangaraju29139 commented Aug 22, 2023

Hi everyone and @everdimension , I am beginner to Open-sourse Contributions and React ecosystem.
With whatever understanding that I have understood from this issue, I just want to express my point of view.

My Observations:
As it is mentioned in the share readmefile, the shared library have the helper functions only to core and web libraries. I Don't think rafz has to be included as a dependency to web.

My Proposed Solution: If we are using the "@react-spring/rafz" functionality , we have to explicitly import it.
image

shared docs

Appreciate the feedback if I have misunderstood the issue.

Thanks
rangaraju

robintown added a commit to element-hq/element-call that referenced this issue Sep 1, 2023
@Producdevity
Copy link

Producdevity commented Oct 24, 2023

Sure!

Turns out this wasn't a parcel issue, but a tsc issue

Here's the reproduction repo: https://github.com/everdimension/react-spring-raf-repro

@everdimension Could you explain how you determined this? Thanks!

@sarocu
Copy link

sarocu commented Apr 4, 2024

I additionally ran into this when disabling hoisting within PNPM - what was the tsc workaround?

@wegry
Copy link

wegry commented Apr 5, 2024

@sarocu With Yarn 4, adding a explicit dependency in the .yarnrc.yml (I think pnpm has a similar mechanism) should do the trick.

# yarnrc.yml
packageExtensions:
  "@react-spring/shared@*":
    dependencies:
      "@react-spring/rafz": "*"
  "@react-spring/web@*":
    dependencies:
      "csstype": "*"

wegry pushed a commit to wegry/react-spring that referenced this issue Apr 8, 2024
wegry pushed a commit to wegry/react-spring that referenced this issue Apr 9, 2024
@tylerlaprade
Copy link

I also have this problem when running tsc. For now, I manually added @react-spring/rafz to my package.json, but ideally this dependency would be included directly in @react-spring/web.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working type: good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants