Skip to content

[Bug]: V7, controls description not showing, TypeScript, Vite, react-docgen-typescript #23084

Description

@Kureyko

Describe the bug

Every component in Storybook has TypeScript types where every prop has JSDoc comment.
image

Previously in Storybook 6 everything worked correctly.
All controls had description and default values shown and they were populated correctly via react-docgen-typescript.
But after migrating to Storybook 7 and going "full Vite" controls are not showing any description.
image

I also tried Webpack5 with Storybook 7 and seems that description did show up:

image

I've also switched between react-docgen and react-docgen-typescript and react-docgen did work better, but still some comments/description were missing.

To Reproduce

The project is private, don't have rights to share it.

System

System:
    OS: macOS 13.2.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.19.1/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
  Browsers:
    Chrome: 114.0.5735.133
    Safari: 16.3
  npmPackages:
    @storybook/addon-a11y: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/addon-actions: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/addon-docs: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/addon-essentials: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/addon-links: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/blocks: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/client-api: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/react: ^7.1.0-alpha.32 => 7.1.0-alpha.33 
    @storybook/react-vite: ^7.1.0-alpha.32 => 7.1.0-alpha.33

Additional context

I have a monorepo setup and Storybook collects all the story files correctly. These are the settings:

// apps/workshop/.storybook/main.ts
import type { StorybookConfig } from '@storybook/react-vite';
import remarkGfm from 'remark-gfm';

const conf: StorybookConfig = {
  stories: [
    '../src/*.mdx',
    '../src/hooks/*.mdx',
    '../../../packages/**/*.stories.@(js|jsx|ts|tsx|mdx)'
  ],
  staticDirs: ['./static'],
  framework: {
    name: '@storybook/react-vite',
    options: {}
  },
  addons: [
    {
      name: '@storybook/addon-essentials',
      options: {
        docs: true,
        actions: true,
        backgrounds: true,
        controls: true
      }
    },
    {
      name: '@storybook/addon-docs',
      options: {
        transcludeMarkdown: true,
        mdxPluginOptions: {
          mdxCompileOptions: {
            // Styled tables, etc.
            remarkPlugins: [remarkGfm]
          }
        }
      }
    },
    '@storybook/addon-a11y',
    'storybook-addon-designs'
  ],
  typescript: {
    check: true,
    // react-docgen-typescript not working atm
    reactDocgen: 'react-docgen-typescript',
    reactDocgenTypescriptOptions: {
      shouldExtractLiteralValuesFromEnum: true,
      shouldRemoveUndefinedFromOptional: true,
      propFilter: (prop) =>
        prop.parent ? !/node_modules/.test(prop.parent.fileName) : true
    }
  },
  docs: {
    autodocs: true
  }
};

export default conf;
// apps/workshop/vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), tsconfigPaths()],
  resolve: {
    alias: [
      {
        // https://github.com/vitejs/vite/issues/5764
        // this is required for the SCSS modules
        find: /^~(.*)$/,
        replacement: '$1'
      }
    ]
  }
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions