UX-and-I / storybook-design-token

Display design token documentation generated from your stylesheets and icon files. Preview design token changes in the browser. Add your design tokens to your Storybook Docs pages using the custom Doc Blocks.
https://dev.to/psqrrl/managing-design-tokens-using-storybook-5975
MIT License
642 stars 123 forks source link

Missing "./dist/doc-blocks" specifier in "storybook-design-token" package? #202

Open fglendrange opened 8 months ago

fglendrange commented 8 months ago

I seem to be running into an issue when trying to use the DocBlock for the design tokens as described in these instances: https://github.com/UX-and-I/storybook-design-token/blob/v1/demo/src/design-tokens/colors.stories.mdx https://storybook.js.org/addons/storybook-design-token https://github.com/UX-and-I/storybook-design-token/blob/v3/addon/src/stories/Introduction.mdx

I am runing v3. Is there any e.g. Vite specific things I would need to incorporate?

Eg 1:

import { Meta, Story, Canvas } from '@storybook/addon-docs';
import { DesignTokenDocBlock } from 'storybook-design-token/dist/doc-blocks';

<Meta title="Design Tokens/Colors" />

# Colors

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Pariatur qui ut
beatae nam molestiae cum doloremque fugit nihil, vitae modi recusandae culpa
odit facere eum vel reiciendis eius repellat, totam aperiam. Molestiae error
voluptatibus et neque vel libero, harum nam quibusdam mollitia, sapiente rerum
iste modi sit deserunt? Officiis, quaerat!

<DesignTokenDocBlock categoryName="Colors" />

## As cards

<DesignTokenDocBlock categoryName="Colors" viewType="card" />

Error in terminal:

[vite] Internal server error: Missing "./dist/doc-blocks" specifier in "storybook-design-token" package

Error in browser:

Failed to fetch dynamically imported module: http://localhost:6006/.storybook/Tokens/colors.stories.mdx
pawelpukszta commented 8 months ago

Hi @fglendrange,

Do these errors also occur when the import path in the colors.stories.mdx file is like this?: import { DesignTokenDocBlock } from 'storybook-design-token'

gleissonneves commented 1 month ago

This worked perfectly for me.

my version storybook is: ^8.3.0-alpha.3

I saw that in the main readme, we already have this documentation. It is likely that in parallel sites it is out of date