react-styleguidist icon indicating copy to clipboard operation
react-styleguidist copied to clipboard

Broken React 17 support in v13.1.0

Open SevereCloud opened this issue 1 year ago • 4 comments

Current behavior

Broken support React 17 in v13.1.0

To reproduce

https://github.com/VKCOM/VKUI/pull/4225

Building style guide...
 FAIL  Failed to compile

Module not found: Error: Can't resolve 'react-dom/client' in '/home/runner/work/VKUI/VKUI/node_modules/react-styleguidist/lib/client'
Module not found: Error: Can't resolve 'react-dom/client' in '/home/runner/work/VKUI/VKUI/node_modules/react-styleguidist/lib/client/rsg-components/Preview'
error Command failed with exit code 1.

Expected behavior

  • React 17 support in v13
  • #2125 is Breaking Change

SevereCloud avatar Feb 14 '23 07:02 SevereCloud

Depends on the goal of the maintainer, I do think it's possible to support both by adding extra complexity on build time.

A dirty hack that I did on unrelated project is to read the ReactDOM version on build time, and generate a compat virtual module like this:

https://github.com/malcolm-kee/react-showroom/blob/e957135fb07f1adfe49192f3f19fef12c902f04f/packages/react-showroom/src/lib/generate-showroom-data.ts#L554-L606

malcolm-kee avatar Feb 14 '23 07:02 malcolm-kee

yes this should have been a new major version. Sorry about that, you can lock it to 13.0.0. I don't have time / plans to support both 17 & 18

ThomasRoest avatar Feb 14 '23 08:02 ThomasRoest

I have same issue in version 16, what version should I use?

shaddamalbz avatar May 03 '23 01:05 shaddamalbz

For all stumble over this you can use:

"react-styleguidist": "~13.0.0",

which is same as:

"react-styleguidist": "13.0.*",

To keep it the 13.0 version which has React 17 support.

alexander-schranz avatar Mar 25 '24 17:03 alexander-schranz