-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
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-docsand@storybook/addon-docs/blocksto Vite'soptimizeDeps.excludeto prevent pre-bundling and force runtime resolution — this mitigates the issue in our setup. - Use a local shim (project-level) that exposes a stable
ArgsTableexport (or pass explicitrowsto 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/blocksentry) should provide a named exportArgsTableso tools like Vite don't lose that symbol during pre-bundling? - Would you prefer we open a small PR to ensure
ArgsTableis re-exported (alias) as part of the publishedblocksbundle, or is there a recommended configuration change on the consumer side that you endorse instead?
Repro steps (minimal)
- Create a project with Storybook 10.x using
@storybook/react-vite. - Add an MDX page that imports
ArgsTableand uses<ArgsTable of={Component} />(or justimport { ArgsTable } from '@storybook/addon-docs/blocks'and use in MDX) - 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.