-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve "@storybook/core/manager-api" #628
Comments
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,
thanks |
You need to create a metro config file its required in the setup (see readme). npx expo customize metro.config.js See getting started |
thanks @dannyhw , i got it working perfectly |
Hi, @dannyhw I also face the same issue, and i am using expo@46 and ReactNative@69. |
Are you using the storybook commands to run the app? The env variable is being used in your repro. |
@iamdin seems like the older version doesn't support package exports in metro maybe? the package exports option is required in v8 I highly recommend updating expo/rn in your project. |
react native 0.72 would be a minimum, just based on this https://reactnative.dev/blog/2023/06/21/package-exports-support I can't really do anything about that either since storybook core heavily uses package exports to define the entry points for storybook packages. probably the options are stay on storybook 7 or upgrade expo/rn expo 49 has 0.72 btw |
@dannyhw Thank you very much for your time & answer. I indeed used storybook commands to run the app. Unfortunately, When i upgrade to expo49 with RN 0.72, got some file resolution errors. I update the codebase https://github.com/iamdin/react-native-69-storybook
|
I will update the peer dep thing because its out of date, sorry about that. What if you set |
also try Mjs was added by default in I think maybe expo 50 I mean of course if you can then just upgrade all the way to expo 51 |
Hi! I'm using expo 51 and the latest storybook version (8.3.10) and unfortunately come across the same issue. Reverting it back to v.7 fixes it, but we might have to wait for a patch? |
@Fab-Diaz you need to use the withStorybook metro config function, can you make sure you have followed the migration steps carefully. |
@Fab-Diaz @pvinis Try removing storybook from the bundle, it seems to fix the issue for me!
|
After some experimenting I got past this with some advice from @dannyhw . const path = require('node:path');
const { getDefaultConfig } = require('expo/metro-config');
const withStorybook = require('@storybook/react-native/metro/withStorybook');
const { getSentryExpoConfig } = require('@sentry/react-native/metro');
const { withNativeWind } = require('nativewind/metro');
const STORYBOOK_ENABLED =
process.env.STORYBOOK_ENABLED === 'true' || process.env.STORYBOOK_ENABLED === true;
const sentryCfg = STORYBOOK_ENABLED ? getDefaultConfig(__dirname) : getSentryExpoConfig(__dirname);
const storybookCfg = withStorybook(sentryCfg, {
enabled: STORYBOOK_ENABLED,
onDisabledRemoveStorybook: !STORYBOOK_ENABLED,
configPath: path.resolve(__dirname, './.storybook-mobile'),
});
const nativewindCfg = withNativeWind(storybookCfg, {
input: './global.css',
hotServerOptions: { port: 8089 },
});
module.exports = nativewindCfg; I am including the other config-decorators in here so you can see how I handled this in the context of others. this is the critical line that 'just worked' for storybook: const storybookCfg = withStorybook(sentryCfg, {
enabled: STORYBOOK_ENABLED,
onDisabledRemoveStorybook: !STORYBOOK_ENABLED,
configPath: path.resolve(__dirname, './.storybook-mobile'),
}); trying to conditionally include the withStorybook was less successful than just using the flags. |
Encountered similar issue but not using expo. Followed the manual setup doc as well as the multiple entry points for rn metro.config.js
|
@FranchescoLivado I dont recommend that setup with multiple metro configs anymore, it kinda just causes more complications. you are better off using a env variable similar to the expo setup |
Describe the bug
I am trying to add storybook on an expo 51 project with expo-router.
To Reproduce
Steps to reproduce the behavior:
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
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.
The text was updated successfully, but these errors were encountered: