react-ogl icon indicating copy to clipboard operation
react-ogl copied to clipboard

Next.js: 'unstable_act' is not exported from 'react'

Open maximilianberndt opened this issue 1 year ago • 2 comments
trafficstars

When trying to build in next.js I am getting this error:

./node_modules/react-ogl/dist/reconciler.mjs
Attempted import error: 'unstable_act' is not exported from 'react' (imported as 'React').

Seems like the issue is coming from this in reconciler.ts: export const act: Act = 'unstable_act' in React ? (React as any).unstable_act : (React as any).act

I don't have experience with testing in react, so I would really appreciate your help but let me know if I can help you debug this in any way.

maximilianberndt avatar Jun 06 '24 11:06 maximilianberndt

Next.js bundles an experimental copy of React which does not reflect your installed copy, so this is particularly troublesome to debug or even support in the ecosystem as it is SemVer breaking. We'll officially support new APIs with #81.

We did try to fix this issue in #80 and #82. I think I need to break both tree-shaking and static analysis of React in order to fix this.

It's possible we have to wait until React 19 and #81 in order for Next to be usable in OSS.

CodyJasonBennett avatar Jun 06 '24 11:06 CodyJasonBennett

@CodyJasonBennett Got it, thanks for the quick reply!

maximilianberndt avatar Jun 06 '24 11:06 maximilianberndt