title: Storybook fails to show stories
body: <p>the problem we are encountering when trying to add storybook to our project is, that when we run development server, webpack builds every part of the app (resolves ~50,000 dependencies), therefore, when we run it, on network tab we can see unnecessary file downloaded (which contains entire app) that causes entire story (which is downloaded as separate file due to <code>storyStoreV7</code> flag) to crash, because some lines of unnecessary bundle are raising errors (files aren't even required to display stories). Example error:</p>
  <pre><code>TypeError: Cannot read properties of undefined (reading 'CheckboxList')
      at Module.CheckboxList (http://localhost:6007/js_components_index_tsx-node_modules_django-channels_dist_sync_recursive-node_modules_moment_-6a9914.iframe.bundle.js:35683:111)
      at Module../js/forms/fields/checkbox-list/index.tsx (http://localhost:6007/js_components_index_tsx-node_modules_django-channels_dist_sync_recursive-node_modules_moment_-6a9914.iframe.bundle.js:41141:103)
      at __webpack_require__ (http://localhost:6007/runtime~main.iframe.bundle.js:28:33)
      at fn (http://localhost:6007/runtime~main.iframe.bundle.js:352:21)
      at Module../js/forms/fields/index.js (http://localhost:6007/js_components_index_tsx-node_modules_django-channels_dist_sync_recursive-node_modules_moment_-6a9914.iframe.bundle.js:43187:73)
      at __webpack_require__ (http://localhost:6007/runtime~main.iframe.bundle.js:28:33)
      at fn (http://localhost:6007/runtime~main.iframe.bundle.js:352:21)
      at Module../js/apps/admin/forms/add-reward-rule/index.tsx (http://localhost:6007/js_components_index_tsx-node_modules_django-channels_dist_sync_recursive-node_modules_moment_-6a9914.iframe.bundle.js:1726:71)
      at __webpack_require__ (http://localhost:6007/runtime~main.iframe.bundle.js:28:33)
      at fn (http://localhost:6007/runtime~main.iframe.bundle.js:352:21)
  </code></pre>
  <p><strike>We found out, that when importing components with <code>React.lazy</code> issue is not present, we can use it this way, but it would be better to use it the &quot;proper&quot; way.</strike></p>
  <p>Storybook version: <code>6.5.0-alpha.42</code></p>
  <p><code>.storybook/main.js</code></p>
  <pre><code>const webpack = require('webpack');
  const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
  const path = require('path');
  const globImporter = require('node-sass-glob-importer');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  
  module.exports = {
    &quot;stories&quot;: [
      &quot;../js/**/*.stories.*&quot;,
    ],
  
    &quot;addons&quot;: [
      &quot;@storybook/addon-links&quot;,
      &quot;@storybook/addon-essentials&quot;,
      &quot;@storybook/addon-interactions&quot;,
      {
        &quot;name&quot;: '@storybook/preset-scss',
        &quot;options&quot;: {
          &quot;sassLoaderOptions&quot;: {
            &quot;sourceMap&quot;: true,
            &quot;sassOptions&quot;: {
              &quot;includePaths&quot;: [path.resolve(__dirname, '../js')],
              &quot;importer&quot;: globImporter(),
            }
          },
          &quot;cssLoaderOptions&quot;: {
            &quot;url&quot;: false,
          }
        }
      }
    ],
  
    &quot;features&quot;: {
      &quot;storyStoreV7&quot;: true,
    },
  
    &quot;framework&quot;: &quot;@storybook/react&quot;,
  
    &quot;core&quot;: {
      &quot;builder&quot;: &quot;webpack5&quot;
    },
  
    &quot;staticDirs&quot;: [path.resolve(__dirname, '../../static')],
  
    &quot;webpackFinal&quot;: async (config) =&gt; {
      config.entry.push(path.resolve(__dirname, '../scss/main.scss'))
  
      config.resolve.plugins = [
        ...(config.resolve.plugins || []),
        new TsconfigPathsPlugin({
          extensions: config.resolve.extensions,
        }),
      ];
  
      config.resolve.alias = {
          ...(config.resolve.alias || {}),
          '@js': path.resolve(__dirname, '../js'),
      }
  
      config.plugins = [
        ...(config.plugins || []),
        new webpack.ProvidePlugin({
          process: 'process/browser',
          Buffer: ['buffer', 'Buffer'],
        }),
        new MiniCssExtractPlugin({
          filename: 'style.css'
        }),
      ]
  
      config.module.rules.push(
        {
          test: /\.svg$/i,
          issuer: /\.[jt]sx?$/,
          use: [{ loader: '@svgr/webpack', options: { ref: true } }],
        }
      )
  
      return config
    }
  }
  </code></pre>
  <p><code>.storybook/preview.tsx</code></p>
  <pre><code>import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
  import { Parameters } from '@storybook/react'
  import { HistoryRouter } from '../js/routes/history-router';
  import { browserHistory } from '../js/routes/history';
  import '../scss/main.scss';
  import theme from '../js/theme'
  
  export const decorators = [
    (Story) =&gt; {
      return &lt;StyledEngineProvider injectFirst&gt;
        &lt;ThemeProvider theme={theme}&gt;
          &lt;HistoryRouter history={browserHistory}&gt;
            {Story()}
          &lt;/HistoryRouter&gt;
        &lt;/ThemeProvider&gt;
      &lt;/StyledEngineProvider&gt;
      }
  ]
  
  export const parameters: Parameters = {
    actions: { argTypesRegex: &quot;^on[A-Z].*&quot; },
    controls: {
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/,
      },
    },
  }
  
  export const argTypes = { children: { type: 'string' }}
  
  </code></pre>
  <p>example story: <code>Button.stories.tsx</code>:</p>
  <pre><code>import React from 'react';
  
  import { ComponentMeta, ComponentStory } from '@storybook/react';
  
  import { Button } from './index';
  
  export default {
      component: Button,
  } as ComponentMeta&lt;typeof Button&gt;;
  
  const Template: ComponentStory&lt;typeof Button&gt; = (args) =&gt; {
      return &lt;Button {...args}&gt;{args.children || 'Button'}&lt;/Button&gt;;
  };
  
  export const Common = Template.bind({});
  Common.args = { variant: 'primary' };
  
  </code></pre>