build error -next js

Creating an optimized production build ...
Failed to compile.

./node_modules/better-auth/dist/client/react/index.mjs
Attempted import error: 'useRef' is not exported from 'react' (imported as 'React').

Import trace for requested module:
./node_modules/better-auth/dist/client/react/index.mjs
./src/lib/auth-client.ts

./node_modules/better-auth/dist/client/react/index.mjs
Attempted import error: 'useSyncExternalStore' is not exported from 'react' (imported as 'React').

Import trace for requested module:
./node_modules/better-auth/dist/client/react/index.mjs
./src/lib/auth-client.ts


Build failed because of webpack errors
error: script "build" exited with code 1

why am getting this error while building

i am using next.js 15.3.0 and react 19.0.0 and better auth "^1.2.7"

@bekacru @Ping
Was this page helpful?