Skip to content

V8 migration issue #614

@mzaien

Description

@mzaien

Describe the bug
After upgrading to storybook v8 and updating metro + running storybook-generate the app did not work I got this error
The package at "node_modules/axios/dist/node/axios.cjs" attempted to import the Node standard library module "url". It failed because the native React runtime does not include the Node standard library.

To Reproduce
Steps to reproduce the behavior:

  1. upgrade to v8
  2. run storybook-generate
  3. update metro
  4. run yarn storybook EXPO_PUBLIC_STORYBOOK_ENABLED='true' expo start --dev-client

Expected behavior
our storybook project opens in the simolator

Screenshots
Image

Code snippets

old metro config

const {getSentryExpoConfig} = require('@sentry/react-native/metro');

const defaultConfig = getSentryExpoConfig(__dirname);
defaultConfig.resolver.resolveRequest = (context, moduleName, platform) => {
    const defaultResolveResult = context.resolveRequest(
        context,
        moduleName,
        platform,
    );

    if (
        (process.env.EXPO_PUBLIC_STORYBOOK_ENABLED !== 'true' &&
            defaultResolveResult?.filePath?.includes?.('.storybook/')) ||
        defaultResolveResult?.filePath?.includes?.('*.stories.tsx')
    ) {
        return {
            type: 'empty',
        };
    }

    return defaultResolveResult;
};

module.exports = defaultConfig;

new metro config

const {getSentryExpoConfig} = require('@sentry/react-native/metro');
const path = require('path');
const withStorybook = require('@storybook/react-native/metro/withStorybook');

const defaultConfig = getSentryExpoConfig(__dirname);

module.exports = withStorybook(defaultConfig, {
    // Use a proper condition to enable Storybook only when the env variable is set to 'true'
    enabled: process.env.EXPO_PUBLIC_STORYBOOK_ENABLED === 'true',
    // Make sure the config path points to the correct Storybook folder
    configPath: path.resolve(__dirname, './.storybook'),
});

System:
Please paste the results of npx -p @storybook/cli@next sb info here.
sh: @storybook/cli@8.4.0-alpha.5: No such file or directory
Image

Additional context
I only have this storybook deps

    "@storybook/addon-ondevice-actions": "^8.3.5",
    "@storybook/addon-ondevice-controls": "^8.3.5",
    "@storybook/react": "^8.3.5",
    "@storybook/react-native": "^8.3.5",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions