stack icon indicating copy to clipboard operation
stack copied to clipboard

React 19 Issues with Vite / HonoX

Open feremabraz opened this issue 6 months ago • 0 comments

Hello.

I'm creating an issue to supplement #693.

I've tried to integrate @stackframe/stack into the Vite-based framework (Honox), and I've run into a persistent issue that I believe is worth documenting.

My initial goal was to build a full-stack app using Honox with Stack for authentication. The initial attempt was with React 19, but I downgraded to React 18 to satisfy Stack's peer dependency requirements. However, the application still fails to launch.

The Vite development server fails to start when @stackframe/stack is included as a dependency. The stacktrace indicates that [email protected] is being loaded, even when the project is explicitly configured to use React 18 and pnpm.overrides are in place to force this version.

I tried the following:

  1. Initial Failure (React 19): The first attempt with React 19 failed due to a peer dependency mismatch.

  2. Downgrade to React 18: I downgraded the project's react and react-dom dependencies to 18.3.1.

  3. Dependency Alignment: I ensured all related dependencies (e.g., @hono/react-renderer) were also compatible with React 18.

  4. Persistent Error: Despite these changes, the Vite dev server continued to crash. The stack trace surprisingly still referenced [email protected]....

  5. Forcing Versions with Overrides: As a final measure, I added pnpm.overrides to force react and react-dom to version 18.3.1 across the entire dependency tree:

"pnpm": {
  "overrides": {
    "react": "18.3.1",
    "react-dom": "18.3.1"
  }
}

Even with the overrides in place, the server crashes with the exact same error.

I believe that Vite's dev server ignores the package manager's override mechanism.

I don't know if this problem is specific to Honox.

The team's question in the original issue—"do you run into any issues upgrading your project to 19 and forcing that react dep?"—can be answered with a yes, at least in my case. Forcing the dependency does not work in this environment:

Framework: Honox (Hono + Vite) Package Manager: pnpm v10.12.1

I hope this report helps to diagnose the issue. Thank you for your attention.

feremabraz avatar Jun 22 '25 22:06 feremabraz