strothj / react-docgen-typescript-loader

Webpack loader to generate docgen information from Typescript React components.
Other
360 stars 47 forks source link

Component Description not displayed #38

Open nimaiwalsh opened 5 years ago

nimaiwalsh commented 5 years ago

Component info is no longer appearing in Storybook

screen shot 2019-03-07 at 14 06 31

Checking the example project, it no longer appears, although the component has comments and the story name matches the display name of your component.

screen shot 2019-03-07 at 14 07 33

screen shot 2019-03-07 at 14 07 05

EXAMPLE: If the top level storiesOf function has the same name as a sub-level component such as FormInputElement, the component description displays for ALL sub components. However, we want a different component description for each subcomponentof the .add function, which is not currently working.

screen shot 2019-03-08 at 09 20 02

Current storybook webpack config file:

const TSPropTypeDocgen = require.resolve('react-docgen-typescript-loader')

module.exports = (baseConfig, env) => {

  baseConfig.module.rules.push({
    test: /\.(ts|tsx)$/,
    use: ['babel-loader', TSPropTypeDocgen]
  })

  baseConfig.module.rules.push({
    test: /\.(sa|sc|c)ss$/,
    loaders: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
  })

  baseConfig.module.rules.push({
    test: /\.(woff|woff2)$/,
    loaders: ['file-loader']
  })

  baseConfig.module.rules.push({
    test: /\.(png|jpg|gif)$/,
    loader: 'file-loader'
  })

  baseConfig.resolve.extensions.push('.ts', '.tsx', '.scss')

  return baseConfig
}
strothj commented 5 years ago

You're right. Can't believe I missed that.

My initial impression is that something changed from the very old v4 alpha and the current stable build of Storybook. My guess is something changed in @storybook/addon-info in how it decides what to display. We will need to see what it expects to find and make adjustments in the loader.

nimaiwalsh commented 5 years ago

Awesome @strothj . Looking forward to hearing what you find. Thanks for all the work on the loader btw.