nextjs doesn't build #836

Closed
opened 2026-03-13 08:06:29 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @mariolim96 on GitHub (Mar 12, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

$ pnpm build

> nextjs-template@0.1.0 build C:\Users\mario\OneDrive\Desktop\fe\new\Easy-Check-In
> pnpm dr:build && pnpm next build


> nextjs-template@0.1.0 dr:build C:\Users\mario\OneDrive\Desktop\fe\new\Easy-Check-In
> npx declarative-routing build

10 total routes
   ▲ Next.js 15.1.5
   - Environments: .env
   - Experiments (use with caution):
     · reactCompiler

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

./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js
Attempted import error: 'useRef' is not exported from 'react' (imported as 'useRef').

Import trace for requested module:
./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js
./src/lib/auth-client.ts

./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js
Attempted import error: 'useSyncExternalStore' is not exported from 'react' (imported as 'useSyncExternalStore').

Import trace for requested module:
./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js
./src/lib/auth-client.ts


> Build failed because of webpack errors
 ELIFECYCLE  Command failed with exit code 1.

this is my client

Image

Current vs. Expected behavior

In theory React 19 have this hooks exported, why this is happening

What version of Better Auth are you using?

1.1.4

Provide environment information

I've already tried to use a different version of better-auth but didn't work (like 1.1.7, 1.2.2, .1.2.3, 1.2.4beta).
I'm currently using 
 "react": "^19.0.0",
 "react-dom": "^19.0.0",
"typescript": "^5.7.3"

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

No response

Originally created by @mariolim96 on GitHub (Mar 12, 2025). ### Is this suited for github? - [ ] Yes, this is suited for github ### To Reproduce ``` $ pnpm build > nextjs-template@0.1.0 build C:\Users\mario\OneDrive\Desktop\fe\new\Easy-Check-In > pnpm dr:build && pnpm next build > nextjs-template@0.1.0 dr:build C:\Users\mario\OneDrive\Desktop\fe\new\Easy-Check-In > npx declarative-routing build 10 total routes ▲ Next.js 15.1.5 - Environments: .env - Experiments (use with caution): · reactCompiler Creating an optimized production build ... Failed to compile. ./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js Attempted import error: 'useRef' is not exported from 'react' (imported as 'useRef'). Import trace for requested module: ./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js ./src/lib/auth-client.ts ./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js Attempted import error: 'useSyncExternalStore' is not exported from 'react' (imported as 'useSyncExternalStore'). Import trace for requested module: ./node_modules/.pnpm/better-auth@1.1.14/node_modules/better-auth/dist/react.js ./src/lib/auth-client.ts > Build failed because of webpack errors  ELIFECYCLE  Command failed with exit code 1. ``` this is my client ![Image](https://github.com/user-attachments/assets/36be269a-a707-4f8b-b56e-f258c753903c) ### Current vs. Expected behavior In theory React 19 have this hooks exported, why this is happening ### What version of Better Auth are you using? 1.1.4 ### Provide environment information ```bash I've already tried to use a different version of better-auth but didn't work (like 1.1.7, 1.2.2, .1.2.3, 1.2.4beta). I'm currently using "react": "^19.0.0", "react-dom": "^19.0.0", "typescript": "^5.7.3" ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 08:06:29 -05:00
Author
Owner

@mariolim96 commented on GitHub (Mar 13, 2025):

Image i found that this was cousing the build crash

@mariolim96 commented on GitHub (Mar 13, 2025): ![Image](https://github.com/user-attachments/assets/9b54914c-7258-42c0-b18b-3df28d46c1fc) i found that this was cousing the build crash
Author
Owner

@meetgoti07 commented on GitHub (Jul 8, 2025):

Check this out: https://github.com/facebook/react/issues/33418#issuecomment-3049500092

@meetgoti07 commented on GitHub (Jul 8, 2025): Check this out: https://github.com/facebook/react/issues/33418#issuecomment-3049500092
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#836