Skip to content
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

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted #147

Open
pst37 opened this issue Sep 21, 2023 · 0 comments

Comments

@pst37
Copy link

pst37 commented Sep 21, 2023

image
//.storybook/main.ts

const config: StorybookConfig = {
    stories: [
        '../storybook/**/*.mdx',
        '../storybook/**/*.story.@(js|jsx|mjs|ts|tsx)'
    ],
    addons: [
        '@storybook/addon-links',
        '@storybook/addon-essentials',
        '@storybook/blocks',
        '@storybook/addon-interactions',
        {
            name: '@storybook/addon-styling',
            options: {}
        },
        '@storybook/addon-a11y',
        '@storybook/addon-designs',
        '@storybook/addon-mdx-gfm',
        'storybook-addon-performance'
    ],
    framework: {
        name: '@storybook/react-webpack5',
        options: {}
    },
    docs: {
        autodocs: 'tag'
    }
};
.storybook/preview.ts
import type { Preview } from '@storybook/react';

import { createGlobalStyle, ThemeProvider } from 'styled-components';
import { withThemeFromJSXProvider } from '@storybook/addon-styling';
import { withPerformance } from 'storybook-addon-performance';
import lightTheme from '../src/constants/defaultThemes/lightThemes';

/* TODO: update import for your custom theme configurations */
// import { lightTheme, darkTheme } from '../path/to/themes';

/* TODO: replace with your own global styles, or remove */
const GlobalStyles = createGlobalStyle`
    body {
      font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    }
  `;

const preview: Preview = {
    parameters: {
        actions: { argTypesRegex: '^on[A-Z].*' },
        controls: {
            matchers: {
                color: /(background|color)$/i,
                date: /Date$/
            }
        }
    },

    decorators: [
        // Adds global styles and theme switching support.
        withThemeFromJSXProvider({
            /* Uncomment for theme switching support */
            themes: {
                light: lightTheme
            },
            defaultTheme: 'light',
            Provider: ThemeProvider,
            GlobalStyles
        }),
        withPerformance
    ]
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant