Storybook: Props table is broken when using more exports in file (vue)

Created on 16 Jan 2020  路  9Comments  路  Source: storybookjs/storybook

Describe the bug
I'm working with VUE.
I have a component that in addition to its default export (as required by SFC) it has some states that are exported for use for others that use this component. In this component stories are working fine, but the props table doesn't show.

Expected behavior
I expect to see the props table in every component

Screenshots
when using exports:
image
without exports:
image

Code snippets

<template>
  <div>
    template
  </div>
</template>

<script>
export const STATES = {
  on: 'on',
  off: 'off'
}

export defualt {
}

System:


Environment Info:

  System:
    OS: macOS 10.15.2
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
  Binaries:
    Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
    Yarn: 1.21.1 - ~/.yarn/bin/yarn
    npm: 6.13.1 - ~/.nvm/versions/node/v10.15.0/bin/npm
  Browsers:
    Chrome: 79.0.3945.117
    Firefox: 70.0.1
    Safari: 13.0.4
  npmPackages:
    @storybook/addon-actions: ^5.3.4 => 5.3.4 
    @storybook/addon-docs: ^5.3.0-rc.14 => 5.3.0-rc.14 
    @storybook/addon-links: ^5.3.4 => 5.3.4 
    @storybook/addons: ^5.3.4 => 5.3.4 
    @storybook/vue: ^5.3.4 => 5.3.4 

also using rails webpacker

docs vue props bug

All 9 comments

@Aaron-Pool @pocka any insights here?

vue-docgen-api not supporting additional named-exports in SFC?
https://codesandbox.io/s/vue-docgen-api-mixed-export-w2xj3

Aha, I thought we already solved this with vue-docgen-loader for the Evergarden stuff... 馃

Would you mind figuring out what we need to do to get this working?

No 馃憣
I'll check source codes of vue-docgen-api and vue-docgen-loader, soon.

Yeah. My guess is that the docgen-api supports mixed default and named exports in a regular js file, but maybe hasn't considered that case in a SFC. It isn't a super common thing, though I think I've done it once or twice in my own code base.

It was that vue-docgen-api cannot parse mixed exports in SFC, as @Aaron-Pool said. I filed an issue on docgen-api repo (https://github.com/vue-styleguidist/vue-styleguidist/issues/717).

You can now parse an SFC including named exports with vue-docgen-api: >=4.6.0.

@pocka do we need to make changes in storybook?

@shilman No, just re-installing vue-docgen-api (after removing lockfile) then it should work! (https://github.com/storybookjs/storybook/blob/next/addons/docs/package.json#L73)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Olian04 picture Olian04  路  78Comments

Gongreg picture Gongreg  路  58Comments

maraisr picture maraisr  路  119Comments

EdenTurgeman picture EdenTurgeman  路  81Comments

ilyaulyanov picture ilyaulyanov  路  100Comments