storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
1.06k stars 154 forks source link

Unable to resolve "@storybook/core/manager-api" #628

Open pvinis opened 5 days ago

pvinis commented 5 days ago

Describe the bug I am trying to add storybook on an expo 51 project with expo-router.

To Reproduce Steps to reproduce the behavior:

  1. I have added the withStorybook in metro.config.js
  2. I have added the require().default bit on my index.tsx
  3. When I start without the storybook_enabled envvar, I get this error:
    Unable to resolve "@storybook/core/manager-api"

I'll try to make a repro tomorrow, with 8.3.10.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Image

Code snippets If applicable, add code samples to help explain your problem.

System: Please paste the results of npx -p @storybook/cli@next sb info here.

Additional context Add any other context about the problem here.

dannyhw commented 5 days ago

Can you make sure that when storybook enabled is false that storybook isnt being loaded by app code (conditionally require it when enabled is true)

You can also try onDisabledRemoveStorybook set to true on the latest version.

Lastly clearing cache can sometimes be required after changing env variables

Alternatively change package exports to true in metro config

alvinlal commented 2 days ago

Can you make sure that when storybook enabled is false that storybook isnt being loaded by app code (conditionally require it when enabled is true)

You can also try onDisabledRemoveStorybook set to true on the latest version.

Lastly clearing cache can sometimes be required after changing env variables

Alternatively change package exports to true in metro config

@dannyhw i am also facing the same issue,

  1. made sure storybook isn't being loaded by app code ✅
  2. where to set onDisabledRemoveStorybook to true ? 🤔
  3. tried clearing cache ✅
  4. can't see a metro config since i am using expo 🤔

thanks

dannyhw commented 2 days ago

You need to create a metro config file its required in the setup (see readme).

npx expo customize metro.config.js

See getting started

https://github.com/storybookjs/react-native#getting-started

alvinlal commented 1 day ago

You need to create a metro config file its required in the setup (see readme).

npx expo customize metro.config.js

See getting started

https://github.com/storybookjs/react-native#getting-started

thanks @dannyhw , i got it working perfectly

iamdin commented 1 hour ago

Hi, @dannyhw I also face the same issue, and i am using expo@46 and ReactNative@69. Here is the minimum reproducible repository: https://github.com/iamdin/react-native-69-storybook