ladle icon indicating copy to clipboard operation
ladle copied to clipboard

React 19 peerDependency issue caused by react-inspector

Open wojtekmaj opened this issue 11 months ago • 4 comments

Describe the bug

  • @ladle/[email protected] marks itself as React 19 compatible
  • It uses react-inspector dependency, which is NOT React 19 compatible, and hasn't been updated for 2 years already.

Unsure if there are any alternatives, but people seem to be navigating away from react-inspector:

Image

Reproduction

Install @ladle/react with React 19, observe peerDependency warnings coming up from your package manager, for example:

➤ YN0060: │ react is listed by your project with version 19.0.0 (p1ec28), which doesn't satisfy what @ladle/react and other dependencies request (but they have non-overlapping ranges!).

Environment

  • OS: [e.g. iOS] n/a
  • Browser [e.g. chrome, safari] n/a
  • Version [e.g. 22] n/a

wojtekmaj avatar Jan 21 '25 09:01 wojtekmaj

Any good alternatives? We could also fork/inline it.

tajo avatar Jan 29 '25 04:01 tajo

I am using PNPM and I just suppressed the warning (the check in my .pnpmfile.cjs) until it's fixed:

module.exports = {
  hooks: {
    readPackage(pkg) {
      // Suppressing react-inspector react peerDependency check
      if (pkg.name === 'react-inspector') {
        pkg.peerDependencies['react'] = '*';
      }
      return pkg;
    },
  },
};

Not ideal, but since I use react-inspector only with ladle - and since react is backwards-compatible - it should work.

(Maybe something won't, I haven't figured what is react-inspector used for yet, and if react 19 makes any difference in this matter, but stories work well)

andrienko avatar Feb 14 '25 10:02 andrienko

It appears that react-inspector is only used by the action addon, which is disabled by default, and I've been unsuccessful at turning on/using, so I'm not sure if it's actually broken or how.

But I feel like there's something missing here with the addon concept, in that they're actually tightly coupled features and dependencies. If I don't need action inspection (and thus don't need react-inspector), there's no way to fully unplug and opt-out.

Was/is the plan to separate the addons into more of a plugin architecture? If so, this one feels like a good first candidate to peel off, since it's causing problems that feel unlikely to be solved upstream given the lack of recent updates to react-inspector.

robheittman avatar Mar 08 '25 01:03 robheittman

react-inspector was recently updated to support react 19 as a peer dependency. So this could likely be resolved by updating to 9.0.0.

I had a quick go myself but I'm not familiar with the ladle package inner workings and had issues with the importing the react-inspect package. Potentially could be resolved by tweaking the moduleResolution in tsconfig.

alastair-smith avatar Sep 12 '25 16:09 alastair-smith