storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.22k stars 9.26k forks source link

Error with storybook addon docs blocks and vite #15281

Closed c10b10 closed 3 years ago

c10b10 commented 3 years ago

Describe the bug

When starting the React Storybook app, I'm getting the Uncaught SyntaxError: The requested module '/node_modules/.vite/@storybook_addon-docs_blocks.js?v=917f9cd3' does not provide an export named 'ArgTypesTable' error in the console.

This happens when importing:

@storybook/addon-docs/blocks

in a story.

To Reproduce

Have a storybook app with

module.exports = {
  stories: ["../src/**/*.stories.@(js|jsx|ts|tsx|mdx)"],
  addons: [
    "@storybook/addon-a11y",
    "@storybook/addon-actions",
    "@storybook/addon-docs",
    "@storybook/addon-essentials",
    "@storybook/addon-links",
    "@storybook/addon-storysource",
    "storybook-styled-components-theme-selector",
    // "@storybook/preset-create-react-app",
  ],
  core: {
    builder: "storybook-builder-vite",
  },
};

in .storybook/main.js, with these dependecies installed in package.json in addition to

    "@vitejs/plugin-react-refresh": "^1.3.1",
    "vite": "^2.3.7",
    "vite-plugin-react-svg": "^0.2.0",
    "vite-plugin-svgr": "^0.3.0"

System

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  System:
    OS: macOS 11.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 840.41 MB / 32.00 GB
    Shell: 3.1.2 - /usr/local/bin/fish
  Binaries:
    Node: 12.20.2 - ~/.nvm/versions/node/v12.20.2/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v12.20.2/bin/npm
  Browsers:
    Chrome: 91.0.4472.106
    Firefox: 89.0
    Safari: 14.1

Used package manager: yarn

shilman commented 3 years ago

There is no ArgTypesTable in either storybook core or the vite-builder. Is that something you are defining in your code?

c10b10 commented 3 years ago

Yes. Remving it solved it. Thank you.