Better AuthBA
Better Auth14mo ago
8 replies
Kazz

Build error after migrating to React 19 and Next.js 15

Getting this error after migrating to react 19 and nextjs 15.
Failed to compile.

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

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

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

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


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


As well as an error making me download the
oslo
package
 ⚠ ./node_modules/.pnpm/better-auth@1.0.14/node_modules/better-auth/dist
Package oslo can't be external
The request oslo/crypto matches serverExternalPackages (or the default list).
The request could not be resolved by Node.js from the project directory.
Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.
Try to install it into the project directory by running npm install oslo from the project directory.



Here are the dependencies I updated:
  "dependencies": {
    "better-auth": "1.0.14",
    "drizzle-orm": "^0.37.0",
    "next": "15.0.4",
    "react": "^19",
    "react-dom": "^19",
  },
  "devDependencies": {
    "@types/node": "^22",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "drizzle-kit": "^0.29.1",
    "eslint": "^9",
    "eslint-config-next": "15.0.4",
    "typescript": "^5"
  }
Was this page helpful?