CurtisC
Convex Community3w ago
1 reply
Curtis

`convex@1.28` introduces an undeclared dependency on `react`

I recently attempted upgrading from convex@1.17 and started getting build errors when running convex generate:

> convex codegen

Finding component definitions...
Generating server code...
Bundling component definitions...
Bundling component schemas and implementations...
✘ [ERROR] Could not resolve "react"

    node_modules/.pnpm/convex@1.28.2/node_modules/convex/dist/esm/react/hydration.js:2:24:
      2 │ import { useMemo } from "react";
        ╵                         ~~~~~~~

  You can mark the path "react" as external to exclude it from the bundle, which will remove this
  error and leave the unresolved path in the bundle.

......

 ELIFECYCLE  Command failed with exit code 1.


I am not using React in my project.
I have installed the packages with pnpm and have this minimal package.json:

{
    "dependencies": {
        "convex": "^1.27.5",
        "vite": "^6.4.1"
    },
    "scripts": {
        "clean": "rimraf dist convex/_generated",
        "dev-backend": "convex dev",
        "dev-frontend": "vite dev",
        "build-backend": "convex codegen",
        "build-frontend": "tsc && vite build"
    },
    "type": "module",
    "devDependencies": {
        "rimraf": "^6.0.1"
    },
    "packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912"
}


These errors occur for 1.28, 1.29, 1.30, and 1.31.
They do not happen for 1.27.
Was this page helpful?