middleware icon indicating copy to clipboard operation
middleware copied to clipboard

react-compat package version

Open BarryThePenguin opened this issue 1 year ago • 5 comments

Would it be possible to release a version of @hono/react-compat so that it is compatible with packages like @hono/auth-js?

@hono/auth-js has a peer dependency for react>=18

https://github.com/honojs/middleware/blob/72d591aa359dff50218162c3c479b713c098fe1e/packages/auth-js/package.json#L54-L58

Otherwise installing @hono/auth-js will run into issues with  ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

 @hono/auth-js 1.0.10
  └ ✕ unmet peer react@>=18: found 0.0.1

https://github.com/honojs/middleware/blob/72d591aa359dff50218162c3c479b713c098fe1e/packages/react-compat/package.json#L4

BarryThePenguin avatar Jul 10 '24 02:07 BarryThePenguin

Hi @BarryThePenguin

Deos it mean this error?

CleanShot 2024-07-18 at 18 03 06@2x

yusukebe avatar Jul 18 '24 09:07 yusukebe

Yes, that's the one! 👍🏻

Specifically when installing with pnpm and strict-peer-dependencies=true

I currently have that disabled, but having the correct peer dependencies installed helps prevent issues with transient dependencies

BarryThePenguin avatar Jul 18 '24 09:07 BarryThePenguin

@BarryThePenguin Thanks!

Hmmm. Now I don't have a solution.

@gaetan-puleo Do you have any thoughts?

yusukebe avatar Jul 18 '24 09:07 yusukebe

Because it is installed as an alias, maybe releasing a version 18.0.0 might work?

Alternatively, it may be a bug with how npm or pnpm install an alias, or how they resolve peer dependencies using an alias?

https://github.com/pnpm/pnpm/issues/4301 looks related 👀

BarryThePenguin avatar Jul 18 '24 09:07 BarryThePenguin

@gaetan-puleo Do you have any thoughts?

Nop :(

Alternatively, it may be a bug with how npm or pnpm install an alias, or how they resolve peer dependencies using an alias?

pnpm/pnpm#4301 looks related 👀

I found this issue too trying to search for a solution

gaetan-puleo avatar Jul 18 '24 11:07 gaetan-puleo

Closing this because it doesn't affect me anymore

BarryThePenguin avatar Aug 23 '25 23:08 BarryThePenguin

I have similar warning:

WARN  Issues with peer dependencies found
apps/website
└─┬ @pkg-org/pkg-with-react-dep 1.0.0
  ├── ✕ unmet peer react@"^18.0.0 || ^19.0.0": found 0.0.3
  ├── ✕ unmet peer react-dom@"^18.0.0 || ^19.0.0": found 0.0.3
  └─┬ react-usestateref 1.0.9
    └── ✕ unmet peer react@>16.0.0: found 0.0.3

Because it is installed as an alias, maybe releasing a version 18.0.0 might work?

Releasing @hono/react-compat with react compatible version seems like a good solution.

If you think about it, alias is supposed to be drop-in replacement for a given package, so it's understandable, that package manager is complaining about version mismatch. People will usually use a fork as an alias, which will follow upstream versioning.

It looks like Hono claims compat with react 19: https://github.com/honojs/hono/blob/4960c063938763a9344c554286e72dcd2545b751/src/jsx/base.ts#L442

theinfinit avatar Nov 17 '25 12:11 theinfinit