Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/local-tests/storybook-blocks/blocks-original.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const PureArgsTable = () => ({ kind: 'pure' });
export const Other = 1;
export const PureArgsTable = () => ({ kind: 'pure' })
export const Other = 1
4 changes: 2 additions & 2 deletions tools/local-tests/storybook-blocks/blocks-reexport.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './blocks-original';
export * from './blocks-original'
// Re-export with a from-clause so the alias is applied to the external export
export { PureArgsTable as ArgsTable } from './blocks-original';
export { PureArgsTable as ArgsTable } from './blocks-original'
14 changes: 7 additions & 7 deletions tools/local-tests/storybook-blocks/blocks.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as blocks from './blocks-reexport';
import * as blocks from './blocks-reexport'

describe('local simulation: blocks re-export', () => {
test('exports ArgsTable', () => {
// debug dump
// eslint-disable-next-line no-console
console.log('DEBUG blocks exports:', Object.keys(blocks));
expect(blocks.ArgsTable).toBeDefined();
});
console.log('DEBUG blocks exports:', Object.keys(blocks))
expect(blocks.ArgsTable).toBeDefined()
})

test('ArgsTable equals PureArgsTable', () => {
expect(blocks.ArgsTable).toBe(blocks.PureArgsTable);
});
});
expect(blocks.ArgsTable).toBe(blocks.PureArgsTable)
})
})
30 changes: 15 additions & 15 deletions tools/patches/PR_DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
PR: re-export `ArgsTable` from `@storybook/addon-docs/blocks`

Summary
-------
## Summary

This small change re-exports the existing `PureArgsTable` implementation as a stable named export `ArgsTable` from `code/addons/docs/src/blocks.ts`.

Rationale
---------
## Rationale

- Some bundlers / pre-bundlers (for example Vite optimizeDeps) can alter the compiled modules and effectively remove/change named exports consumers expect, resulting in runtime errors like:
``Error: The requested module '.../blocks.js' does not provide an export named 'ArgsTable'``
`Error: The requested module '.../blocks.js' does not provide an export named 'ArgsTable'`
- Storybook currently exports an equivalent implementation under a different name (`PureArgsTable`). Re-exporting it under `ArgsTable` restores compatibility with MDX files and third-party docs that import `ArgsTable` directly.

Change
------
## Change

- Add a single line: `export { PureArgsTable as ArgsTable }` in `code/addons/docs/src/blocks.ts` (or the corresponding entry point that builds `blocks` bundle).

Notes / Alternatives
--------------------
## Notes / Alternatives

- Alternatively, we could update the package exports map or build step to guarantee `ArgsTable` is exported explicitly from the built artifact. This PR picks the smallest non-breaking change that is easy to review and test.

Testing
-------
## Testing

- Unit tests for docs blocks should continue to pass.
- Added unit test: `code/addons/docs/src/__tests__/blocks.test.ts` — asserts `ArgsTable` is exported and is an alias of `PureArgsTable`.
- Manual verification: build with Vite and run Storybook + MDX that imports `ArgsTable` to ensure runtime import succeeds.

Changelog
---------
## Changelog

- Fix: re-export `ArgsTable` from `@storybook/addon-docs/blocks` to restore compatibility with imports that expect the named export.

Request
-------
## Request

If maintainers are okay with this approach, I can open a formal PR against Storybook with the change, tests and a short changelog entry.
Loading