react-styleguidist
react-styleguidist copied to clipboard
Broken React 17 support in v13.1.0
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
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
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
I have same issue in version 16, what version should I use?
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.