wagmi: [bug] Can't import the named export 'useSyncExternalStore' from non EcmaScript module

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.3.1

Current Behavior

I have no clue where it originates, I only migrated from ^0.1.3 to ^0.3.1 then suddenly it starts becoming an issue

Expected Behavior

Should not throw this exception

Steps To Reproduce

Create a new project and use multiple hooks and specifically use version ^0.1.3 then migrate to ^0.3.1 so you’ll have to change most hooks since it returns single object

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

Screenshot from 2022-05-02 09-00-03

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 24 (8 by maintainers)

Most upvoted comments

please have a look at https://github.com/tannerlinsley/react-query/releases/tag/v4.0.0-beta.17 where we’ve hopefully fixed the upstream issue.

useSyncExternalStore is backwards compatible and should work with any version of React that supports hooks.

This appears to be an issue with useSyncExternalStore and react-scripts@4. react-scripts@5 works so I recommend upgrading there if you can. Sounds like others have had success with react-app-rewired.

Closing this as wagmi is only supporting react-scripts version 5+ to reduce burden on the core team from debugging old versions.

can confirm, updating to "react-scripts": "5.0.1" resolved this issue for me

for the record, we’re working around this issue using react-app-rewired for the time being, at least until we migrate away from the old CRA version

@tmm we were using react-scripts@4.0.3 . upgrading to v5 would be a large lift since v5 no longer provides polyfills for node core modules by default. see this issue. is that what would be required to get this working?