feat(stories): Lazy load story API type docs#110332
Merged
Conversation
Load story type documentation lazily from MDX exports and resolve it only when opening the API tab. Made-with: Cursor
Replace arrow-function documentation exports with bare dynamic imports
and handle module.default unwrapping in the consuming hook. Remove the
noop type-loader since rspack lazy compilation now defers the expensive
TS compiler work until the docs are actually requested.
- MDX files export `documentation = import('!!type-loader!...')`
- Remove StoryDocumentationExport union type and isStoryDocumentationLoader
- Remove isLoadingDocumentation prop threading
- Remove noop type-loader, always run prod loader
- Enable rspack lazy compilation for type-loader modules via test filter
Co-Authored-By: Cursor <noreply@cursor.com>
Made-with: Cursor
JonasBa
approved these changes
Mar 10, 2026
Convert all .stories.tsx files from static imports
(`import documentation from '!!type-loader!...'`) to lazy dynamic
imports (`export const documentation = import('!!type-loader!...')`),
matching the pattern already used in .mdx files.
Update storyExports.tsx to resolve documentation for TSX stories too,
so API reference docs continue to render.
Co-Authored-By: Cursor <noreply@cursor.com>
Made-with: Cursor
Member
|
Thank you @scttcper! This fixes DE-374 |
scttcper
added a commit
that referenced
this pull request
Mar 11, 2026
Require type-loader imports to use dynamic import so type docs are lazy loaded instead of resolved at module load time. enforces that we don't regress from after enabling lazy loaded types in #110332 Co-authored-by: Cursor <cursoragent@users.noreply.github.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Load story type documentation lazily from MDX exports and resolve it only when opening the API tab, saves the expensive compile time for when requested rather than startup.
Remove CODECOV_ENABLE_BA - unused
Remove STORYBOOK_TYPES - now just disabled for acceptance tests. dev-ui-storybook essentially the same.
fixes DE-374