Skip to content

ArgsTable not exported as named 'ArgsTable' from '@storybook/addon-docs/blocks' when used with Vite/react-vite (prebundling issue) #33691

@wkylin

Description

@wkylin

Context

  • Storybook version used: 10.2.1 (tested)
  • @storybook/addon-docs: 10.2.0 / 10.2.1 (installed via npm)
  • Framework: @storybook/react-vite
  • Environment: Vite (default Storybook builder-vite integration)

Description

When using MDX docs that import ArgsTable via:

import { ArgsTable } from '@storybook/addon-docs/blocks'

and then using in the MDX, Storybook throws an error at runtime:

The requested module '/@fs/.../.vite-cache/storybook/deps/@storybook_addon-docs_blocks.js?...' does not provide an export named 'ArgsTable'

Observed behavior

After Storybook/Vite runs, the prebundled file in .vite-cache/storybook/deps/@storybook_addon-docs_blocks.js contains an export list that includes "ArgsTable as PureArgsTable" (i.e. ArgsTable is renamed to PureArgsTable), but does not export a top-level named "ArgsTable" symbol. Because of that, the ESM named import import { ArgsTable } from '@storybook/addon-docs/blocks' fails in the browser:

Export list excerpt (from .vite-cache):

...
export {
  ...,
  ArgsTable as PureArgsTable,
  ...
}

Root cause hypothesis

This appears to be an interoperability/packaging issue where the Vite pre-bundling or the distributed module's export mapping doesn't provide the expected ArgsTable named export, only PureArgsTable. Consuming code (MDX docs & docs blocks) expects the ArgsTable export to be available from @storybook/addon-docs/blocks.

Short-term workarounds we used successfully

  • Add @storybook/addon-docs and @storybook/addon-docs/blocks to Vite's optimizeDeps.exclude to prevent pre-bundling and force runtime resolution — this mitigates the issue in our setup.
  • Use a local shim (project-level) that exposes a stable ArgsTable export (or pass explicit rows to a shim component) so the MDX docs don't break.

Request / Questions

  • Is this behavior expected for some specific reason (e.g., intentional rename for internal API)?
  • If not expected: could you confirm if the distribution (the ./dist/blocks entry) should provide a named export ArgsTable so tools like Vite don't lose that symbol during pre-bundling?
  • Would you prefer we open a small PR to ensure ArgsTable is re-exported (alias) as part of the published blocks bundle, or is there a recommended configuration change on the consumer side that you endorse instead?

Repro steps (minimal)

  1. Create a project with Storybook 10.x using @storybook/react-vite.
  2. Add an MDX page that imports ArgsTable and uses <ArgsTable of={Component} /> (or just import { ArgsTable } from '@storybook/addon-docs/blocks' and use in MDX)
  3. Start Storybook (npm run storybook) and observe the console error that the module does not provide an export named 'ArgsTable'.

I can provide a small reproduction repository or point to our project traces/logs if that helps. We implemented a working workaround (optimizeDeps.exclude + local shim) but think this warrants an upstream fix or guidance so projects relying on MDX/docs won't need shims.

Thank you — happy to help provide any additional details or a minimal repro.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions