addon help: react as a peer dependency #30552
-
SummaryI'm not sure why, but my addon, addon-storybook-apollo-client doesn't seem to work with React 18 unless I specify react as a peer dependecy, however addon-kit throws an error during deploy saying it should not be a peer dependency. I think the issue is related to my preview file where I am dynamically injecting a decorator to wrap stories with the apollo MockedProvider Additional informationrepo: https://github.com/lifeiscontent/storybook-addon-apollo-client Create a reproductionhttps://github.com/joostslijkoort/react-vite-storybook-apollo-reproduction |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Since you're using React in the preview, having React as a peer dependency is actually the right thing to do, and you should disable the prepublish check. It's very uncommon for an addon to be using React in the preview (but totally valid for your use case), 99 % of the addons only use it in the manager, where it should be a dev dependency. Maybe the error message can be more explicit in saying this, I'm not sure. Let me know if it works. |
Beta Was this translation helpful? Give feedback.
Since you're using React in the preview, having React as a peer dependency is actually the right thing to do, and you should disable the prepublish check.
It's very uncommon for an addon to be using React in the preview (but totally valid for your use case), 99 % of the addons only use it in the manager, where it should be a dev dependency.
Maybe the error message can be more explicit in saying this, I'm not sure.
Let me know if it works.