Storybook/react incompatible with older versions of react
See original GitHub issueDescribe the bug We tried to setup a new storybook with an older version of React and see a number of issues from npm. Our particular project is constrained to react 16.4.1 for a variety of reasons; upgrading it is not an option. React will be provided as a webpack external, hence loaded outside of webpack bundle (oh the joys of working with legacy code).
Youโd think this would work because @storybook/react
has an extremely broad peer dependency, but thatโs not what weโre seeing.
To Reproduce Steps to reproduce the behavior:
npm install --save-dev react@16.4.1 react-dom@16.4.1
npm install --save-dev @storybook/react
npm install --save-dev babel-loader @babel/core
npm ls react
Expected behavior npm lists the versions of react; all react dependencies and peer dependencies are satisfied.
Screenshots
% npm ls react
my-react-components@2.15.0 /Users/zebraflesh/projects/my-react-components
โโโฌ @storybook/react@5.3.19
โ โโโฌ @storybook/addons@5.3.19
โ โ โโโฌ @storybook/api@5.3.19
โ โ โโโ react@16.13.1
โ โโโฌ @storybook/core@5.3.19
โ โโโฌ @storybook/ui@5.3.19
โ โโโฌ @storybook/components@5.3.19
โ โ โโโ UNMET PEER DEPENDENCY react@16.13.1
โ โโโ UNMET PEER DEPENDENCY react@16.13.1
โโโ react@16.4.1
npm ERR! peer dep missing: react@^16.6.0, required by react-helmet-async@1.0.6
npm ERR! peer dep missing: react@^16.8.0, required by react-focus-lock@2.4.0
npm ERR! peer dep missing: react@^16.6.0, required by react-helmet-async@1.0.6
npm ERR! peer dep missing: react@^16.6.0, required by react-popper-tooltip@2.11.1
Code snippets N/A
System: System: OS: macOS 10.15.5 CPU: (8) x64 Intelยฎ Coreโข i7-6700K CPU @ 4.00GHz Binaries: Node: 12.18.1 - ~/.nvs/node/12.18.1/x64/bin/node npm: 6.14.5 - ~/.nvs/node/12.18.1/x64/bin/npm Browsers: Chrome: 83.0.4103.116 Edge: 83.0.478.54 Firefox: 75.0 Safari: 13.1.1 npmPackages: @storybook/react: ^5.3.17 => 5.3.19
Additional context A few things here are surprising:
- Various utilities that have strict react version requirements are pulled in (react-helmet-async, etc.), but whatever storybook packages are pulling them in are not supplying the necessary version.
@storybook/components
reporting an unmet peer dependency at all โ the parent@storybook/ui
package it has a direct dependency on react
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:14 (3 by maintainers)
Top GitHub Comments
This is still an issue, even with react-scripts 3.4.3. That depends on webpack 4.42.0, where @storybook/core (for @storybook/react 6.0.21) requires webpack 4.43.0. Short of setting
SKIP_PREFLIGHT_CHECK=true
, I havenโt found any way to work around this.Iโm not sure since that example doesnโt actually run from 5.13.9 tag. I see the following output (and get similar output running from the head of the
next
branch):edit: That example shows similar issues to what I reported above: