Framework and build integration
Storybook connects a user application to its preview through three choices: a framework package, a build tool, and a renderer. The integration layer normalizes those choices, combines their presets, and produces a preview that behaves like the application while still supporting Storybook features.
Integration model
The framework package is the product-facing entry point. It selects the build tool and renderer, then adds the application rules needed by that framework. The builder turns the combined configuration into a development server or production output. The renderer mounts each story in the preview.
flowchart LR
A[Storybook configuration] --> B[Framework preset]
B --> C[Normalized framework]
C --> D[Builder selection]
C --> E[Renderer selection]
D --> F[Preview bundle or dev server]
E --> G[Framework-specific story output]
F --> G
G --> H[Interactive preview]
Framework selection
Framework selection starts with the framework value in the Storybook main configuration. The value can be a package name or an object with options. Storybook resolves it to a stable framework name before it derives the matching builder and renderer, so package paths and package-manager layout do not change the selected integration. (See code/…/get-framework-name.ts• L8-45.)
The supported mapping keeps application concerns separate from preview concerns. For example, React Vite and React Webpack use the same React renderer but different builders, while Next.js adds framework rules around the React renderer. The package set also includes Vite integrations for SvelteKit and TanStack React, which layer application behavior on top of the shared Vite and React or Svelte paths. (See code/…/framework.ts• L3-68, code/…/package.json• L70-86, and code/…/package.json• L77-103.)
Framework package manifests make these relationships installable. They declare the builder and renderer packages that form the integration, plus peer ranges for the application framework and build tool. This keeps package selection and runtime compatibility aligned across the supported framework variants. (See code/…/package.json• L54-77, code/…/package.json• L50-65, code/…/package.json• L90-116, and code/…/package.json• L103-153.)
References: code/…/get-framework-name.ts• L8-45 code/…/framework.ts• L3-68 code/…/frameworks.ts• L2-27 code/…/builders.ts• L1-6 code/…/package.json• L70-86 code/…/package.json• L77-103 code/…/package.json• L54-77 code/…/package.json• L50-65 code/…/package.json• L90-116 code/…/package.json• L103-153
Preset composition
Presets are the shared contract between framework packages, builders, renderers, and user configuration. Storybook loads preset layers in order, expands nested presets, and exposes an apply operation that combines one setting across all layers. A preset can provide a value or transform the value that came before it. (See code/…/presets.ts• L187-245 and code/…/presets.ts• L276-356.)
This model lets a framework package assemble a complete integration without owning the whole build. A framework can select a builder and renderer through the core preset, add preview annotations, and extend builder configuration through viteFinal or webpackFinal. User configuration remains part of the same chain. (See code/…/preset.ts• L10-13 and code/…/preset.ts• L9-18.)
The same chain carries the choice between server-side and builder-side component metadata. The React Vite preset leaves the Vite config unchanged when the docgen server is active. Otherwise it reads the selected React docgen mode and adds the matching optional builder plugins. This prevents server extraction and preview-bundle extraction from both adding metadata for the same component. (See code/…/preset.ts• L18-74 and code/…/framework-preset-react-docs.ts• L13-23.)
References: code/…/presets.ts• L187-245 code/…/presets.ts• L276-356 code/…/preset.ts• L10-13 code/…/preset.ts• L18-74 code/…/framework-preset-react-docs.ts• L13-23
Builder and renderer pairing
Each framework maps to one builder and one renderer. The builder owns how preview code is served or built. The renderer owns how a story becomes framework output inside the preview. Storybook also publishes the selected builder, framework, and renderer as shared runtime values so the surrounding system can make matching decisions. (See code/…/framework.ts• L9-35.)
The current core builder choices are Vite and Webpack 5, with community support for Rsbuild. Core framework packages cover targets such as React, Angular, Vue, Svelte, HTML, Web Components, Next.js, and server rendering. The mapping is the important contract: a framework package must point to a builder and renderer that understand its story and application model. (See code/…/builders.ts• L1-6, code/…/framework.ts• L43-68.)
The builder manifests define the build-tool boundary. The Vite builder accepts supported Vite releases as a peer, while the Webpack builder supplies the Webpack 5 path and its preview support. Framework manifests then narrow or extend those ranges for the application they adapt. (See code/…/package.json• L30-63, code/…/package.json• L29-83, and code/…/package.json• L70-86.)
References: code/…/framework.ts• L9-35 code/…/builders.ts• L1-6 code/…/framework.ts• L43-68 code/…/package.json• L30-63 code/…/package.json• L29-83 code/…/package.json• L70-86
Build adaptation
Builders receive the preset result and produce the preview environment. They support both development and production paths, but the shared goal is the same: transform application code and Storybook entry points into a preview that can load stories and report build errors.
Vite output
The Vite builder creates the development server and runs the production build. Its core preset adds Storybook plugins for project annotations, configuration loading, dependency handling, environment control, and preview mocks. In production, it also maps the resolved public directory into the output. (See code/…/index.ts• L65-91 and code/…/preset.ts• L17-52.)
The builder also loads the user's Vite configuration for the selected mode. Users can opt out of that loading, and Storybook warns when automatic discovery finds a config outside the expected project area. Storybook keeps build settings that could conflict with its preview pipeline under the viteFinal extension point. (See code/…/vite-config.ts• L45-117 and code/…/vite-config.ts• L137-176.)
Framework packages add their Vite rules after this base layer. React, Svelte, and Vue select Vite with their matching renderer, then add framework transforms or metadata services when the selected mode needs them. Angular also adapts workspace styles, aliases, bootstrap behavior, component metadata, and Storybook mock behavior so Vite follows Angular application rules even when the Angular compiler emits the final source. (See code/…/preset.ts• L10-74, code/…/preset.ts• L16-48, code/…/preset.ts• L20-51, and code/…/preset.ts• L82-246.)
For builds that request stats, Vite exposes its module graph in a Webpack-style form for downstream change-impact tools such as TurboSnap. The graph includes normal and dynamic imports, virtual modules, and relevant files watched by transforms, while development builds avoid the extra watch-file capture. (See code/…/vite-config.ts• L179-191 and code/…/webpack-stats-plugin.ts• L76-183.)
References: code/…/index.ts• L65-91 code/…/preset.ts• L17-52 code/…/vite-config.ts• L45-117 code/…/vite-config.ts• L137-191 code/…/webpack-stats-plugin.ts• L76-183 code/…/preset.ts• L10-74 code/…/preset.ts• L16-48 code/…/preset.ts• L20-51 code/…/preset.ts• L82-246
Webpack output
The Webpack 5 builder applies the preview preset, creates a compiler, and serves the result through development middleware or writes a production build. Its configuration passes through the preset chain, which allows framework packages and user settings to extend the default configuration. (See code/…/index.ts• L71-85 and code/…/index.ts• L139-225.)
The default Webpack layer also adds the preview entry and development hot-reload support. Framework-specific presets can then add aliases, loaders, compiler choices, or application rules. Next.js uses this layer to bring its own config, CSS, image, font, and compiler behavior into the Storybook preview. React's Webpack docs preset adds component metadata only when the selected docs mode needs builder-side extraction. (See code/…/preview-preset.ts• L3-28, code/…/preset.ts• L148-204, and code/…/framework-preset-react-docs.ts• L13-97.)
Webpack also applies Storybook mock contracts during module resolution. It maps preview mock declarations to the files that Webpack resolves for both module systems, redirects bare imports when the browser build cannot resolve the original package, and watches the relevant configuration and mock paths so changes reach the preview. (See code/…/webpack-mock-plugin.ts• L18-119.)
References: code/…/index.ts• L71-85 code/…/index.ts• L139-225 code/…/preview-preset.ts• L3-28 code/…/preset.ts• L148-204 code/…/framework-preset-react-docs.ts• L13-97 code/…/webpack-mock-plugin.ts• L18-119
Framework adaptation
Framework packages bridge the gap between a generic Storybook preview and an application framework. They select the base builder and renderer, load framework-specific preview annotations, and adapt compiler or metadata services where the framework needs them.
Application configuration
Framework presets carry application options through the shared preset context. This lets a framework read settings such as a project config path or compiler mode while keeping the builder responsible for the final bundle. Angular Vite translates Angular workspace options into Vite behavior and preserves framework style and bootstrap rules. It also keeps aliases and style paths rooted in the Angular workspace rather than only in the Storybook preview root. (See code/…/preset.ts• L81-158 and code/…/preset.ts• L440-517.)
Angular's metadata mode is part of this adaptation. When the docgen server supplies component data, the preset avoids an unnecessary whole-project metadata scan and supplies a safe empty document for older generated preview imports. When that server is not active, the Vite path can still prepare the application metadata that the preview needs. Angular's docgen provider supports both compiler and native TypeScript APIs, so docgen can use a supported native API without changing the TypeScript version required by the Angular compiler. (See code/…/preset.ts• L28-39 and code/…/preset.ts• L113-144.)
Angular's CLI-facing integrations expose separate start and build schemas for the Webpack and Vite paths. These schemas carry workspace targets, TypeScript settings, styles, assets, source maps, logs, stats output, and change-detection choices into the selected builder. The Vite schemas mark the old Compodoc options as deprecated because Angular metadata is extracted in process, while the Webpack schemas retain the Compodoc settings used by that path. (See code/…/start-schema.json• L7-186, code/…/build-schema.json• L7-151, code/…/start-schema.json• L7-161, and code/…/build-schema.json• L7-126.)
The schema checks protect this command-line boundary. Both Angular integrations accept the same defined log levels and reject unknown values. The Vite schemas also keep statsJson as string-first when it accepts a string or boolean, because the Angular CLI uses the first type when it builds its command-line parser. (See code/…/schemas.test.ts• L10-55 and code/…/schemas.test.ts• L7-35.)
Next.js prepares the Next configuration before Webpack uses it, then applies the framework's build rules to the shared config. This keeps the Storybook preview aligned with the application rather than treating the application as a generic Webpack project. (See code/…/preset.ts• L28-49 and code/…/preset.ts• L148-204.)
References: code/…/preset.ts• L28-39 code/…/preset.ts• L81-158 code/…/preset.ts• L113-144 code/…/preset.ts• L440-517 code/…/start-schema.json• L7-186 code/…/build-schema.json• L7-151 code/…/start-schema.json• L7-161 code/…/build-schema.json• L7-126 code/…/schemas.test.ts• L10-55 code/…/schemas.test.ts• L7-35 code/…/preset.ts• L28-49 code/…/preset.ts• L148-204
Preview annotations
Preview annotations are framework entry points that load before stories run. They provide the renderer and optional framework services such as docs support, component metadata, or framework setup. The framework preset adds them to the existing annotation list instead of replacing annotations from other presets. (See code/…/preset.ts• L61-87 and code/…/preset.ts• L22-35.)
This composition gives every framework the same preview lifecycle while allowing different output rules. React can add docs, arg types, and server-component entries. Vue and Svelte add their own docs entries and import or story index services. Web Components add DOM rendering and arg-type support. The annotations include docs only when the docs preset is active. (See code/…/preset.ts• L61-87, code/…/preset.ts• L19-34, code/…/preset.ts• L22-35, and code/…/preset.ts• L24-41.)
Svelte also adapts compiled *.stories.svelte files into CSF story modules. The adapter uses the user's Svelte preprocessors and source plus the compiled output, then resolves the Storybook runtime before Vite's normal resolver can pre-bundle it. Its story-markup parser supports TypeScript markup and keeps edit positions mapped to the original source. It retains story CSS when a file contains metadata without a default export. (See code/…/svelte-csf.ts• L10-49, code/…/transform.ts• L25-63, and code/…/markup.ts• L7-53.)
The Svelte runtime turns collected <Story> declarations into normal CSF stories. It preserves the nearest inherited content, play function, and child mode, then merges args from the story chain. Play functions run through the component scope so they retain the behavior of the source story. (See code/…/create-runtime-stories.ts• L18-23 and code/…/create-runtime-stories.ts• L43-109.)
References: code/…/preset.ts• L61-87 code/…/preset.ts• L19-34 code/…/preset.ts• L22-35 code/…/preset.ts• L24-41 code/…/svelte-csf.ts• L10-49 code/…/transform.ts• L25-63 code/…/markup.ts• L7-53 code/…/create-runtime-stories.ts• L18-23 code/…/create-runtime-stories.ts• L43-109
SvelteKit adaptation
The SvelteKit framework package adapts the shared Svelte and Vite preview to SvelteKit's application boundary. Its preset selects the Vite builder and Svelte renderer, preserves production static assets, disables incompatible Kit build plugins, and adds the rules needed for Kit config sync, public environment values, server-module protection, and browser-safe module mocks. (See code/…/preset.ts• L17-62.)
The preview supplies Storybook versions of SvelteKit's page state, navigation, and form APIs. Story setup can set these values in beforeEach, while the framework resets them before each story and intercepts same-window links so a story cannot navigate away from the preview. The SvelteKit preview factory includes these annotations and keeps the mock types available to stories. (See code/…/index.ts• L21-34, code/…/preview.ts• L31-91, code/…/navigation.ts• L17-139, and code/…/app-state-mock.svelte.js• L236-267.)
Docs pages need a separate rule because several stories share one document. If more than one inline story tries to configure the shared SvelteKit mocks during setup, Storybook stops with a clear error instead of showing one story's state in another. Stories that need different mock state must render in separate iframes, while stories that do not change mock setup can remain inline. (See code/…/docs-isolation.ts• L71-138, code/…/errors.ts• L25-50, and code/…/docs-page-isolated-mocks.stories.js• L5-26.)
The SvelteKit form mock keeps the main form contract usable without a server. It sends submissions to a story-controlled action, applies success, failure, redirect, and error results to the mocked page state, and drops late results after a story ends. This lets interaction tests exercise application states without leaving the preview. (See code/…/forms.ts• L15-179 and code/…/forms.stories.js• L18-100.)
References: code/…/preset.ts• L17-62 code/…/index.ts• L21-34 code/…/preview.ts• L31-91 code/…/navigation.ts• L17-139 code/…/app-state-mock.svelte.js• L236-267 code/…/docs-isolation.ts• L71-138 code/…/errors.ts• L25-50 code/…/forms.ts• L15-179
Renderer output
Renderers turn the normalized story result into the target framework's runtime form. They expose a common Storybook rendering contract, but each renderer handles mounting, updates, teardown, and framework-specific story values in the way its target requires.
Component mounting
The renderer receives a story function and a canvas element. React creates an element from the story component and its args. Vue creates or updates an application and keeps args and globals reactive. Svelte mounts a preview component and updates its reactive props. (See code/…/render.tsx• L7-15, code/…/render.ts• L53-121, and code/…/render.ts• L45-109.)
Angular bootstraps an application in the story canvas and supplies story props and application providers to it. When only props change, the renderer can reuse the running application; a changed template or module shape requires a new application. It also tears down component views before the application so story changes do not retain old Angular state. (See code/…/AbstractRenderer.ts• L36-63, code/…/AbstractRenderer.ts• L97-167, and code/…/AbstractRenderer.ts• L81-167.)
The Angular renderers normalize story and story-UID values before using them as HTML names or selector attributes. This keeps stories with non-ASCII identifiers mountable in the canvas. The Vite path also supports direct zoneless change detection, while the Angular beta path checks that the installed Angular version supports its experimental option. (See code/…/AbstractRenderer.ts• L126-219 and code/…/AbstractRenderer.ts• L125-207.)
HTML follows the same contract without a component runtime. It accepts an HTML string, a DOM element, or a function that returns one, then places the result in the canvas. Unsupported output becomes a clear story error instead of an invalid preview. (See code/…/render.ts• L12-69.)
The published renderer packages expose matching preview entry points for their targets. React and Preact share component-style entry points, while HTML, server output, Svelte, Vue, and Web Components expose their own preview and docs paths. Framework packages depend on the renderer that matches the story output they produce. (See code/…/package.json• L23-45, code/…/package.json• L27-37, code/…/package.json• L27-36, code/…/package.json• L26-34, code/…/package.json• L27-75, code/…/package.json• L27-46, and code/…/package.json• L29-45.)
References: code/…/AbstractRenderer.ts• L36-63 code/…/AbstractRenderer.ts• L97-167 code/…/AbstractRenderer.ts• L126-219 code/…/AbstractRenderer.ts• L81-167 code/…/AbstractRenderer.ts• L125-207 code/…/render.tsx• L7-15 code/…/render.ts• L53-121 code/…/render.ts• L45-121 code/…/render.ts• L12-69 code/…/package.json• L23-45 code/…/package.json• L27-37 code/…/package.json• L27-36 code/…/package.json• L26-34 code/…/package.json• L27-75 code/…/package.json• L27-46 code/…/package.json• L29-45
Framework metadata
Renderer and framework presets also connect build-time metadata to the preview. React, Vue, Svelte, and Angular can enable component manifests or docgen services so Storybook can describe component inputs and produce docs. The build path may provide metadata through plugins, while the renderer consumes the result during story display. (See code/…/preset.ts• L33-59, code/…/preset.ts• L7-20, code/…/preset.ts• L28-41, and code/…/preset.ts• L9-21.)
React component resolution gives the manifest and docgen paths one shared view of a story file. It follows local bindings, namespace properties, and re-exports, then matches meta.component before using the story title as a fallback. Declared subcomponents use the same resolution rules, so an unresolved export remains visible as a specific metadata problem instead of changing the primary component silently. (See code/…/resolveComponents.ts• L34-51 and code/…/resolveComponents.ts• L82-202.)
Vue server docgen uses one extraction path for the primary component and each declared subcomponent. It follows re-exports before reading component metadata, then creates descriptions, arg types, and API details from the declaring component. A child extraction error stays on that child entry, so one broken subcomponent does not remove the primary component's docs. (See code/…/build-docgen.ts• L123-182 and code/…/build-docgen.ts• L185-239.)
This split matters when a project changes its docgen mode. The framework and renderer must agree on whether metadata is injected into the preview or supplied by a server-side service. The preset chain carries that choice across the build and preview boundaries. React Vite and React Webpack skip builder-side injection when the docgen server owns extraction. Svelte and Vue apply their builder plugins only when their server mode is not active. (See code/…/preset.ts• L18-26, code/…/framework-preset-react-docs.ts• L13-23, code/…/preset.ts• L27-39, and code/…/preset.ts• L28-45.)
React server docgen keeps the raw component metadata for non-UI consumers and also produces renderer-shaped argTypes for the main component and its subcomponents. The conversion preserves source-level default values and removes React's inherited key and ref attributes from the public component API. If a story file cannot be read or parsed, the provider returns no payload so another provider can handle the entry. The provider supports compiler and native TypeScript APIs, and can use the TypeScript package selected for docgen when the Storybook config supplies that context. (See code/…/buildDocgen.ts• L34-92, code/…/buildDocgen.ts• L95-158, code/…/preset.ts• L39-52, and code/…/preset.ts• L150-163.)
Svelte server-side docgen keeps one metadata manager for the worker lifetime. It reads the project configuration, derives component metadata through the Svelte compiler view, and refreshes that view when component or type files change. The resulting payload describes the story component and its subcomponents for the docs system. (See code/…/docgen-worker.ts• L7-32, code/…/svelte-project-manager.ts• L31-45, and code/…/build-docgen.ts• L32-90.)
Svelte component API descriptions expose typed props, events, and slots. They preserve useful defaults, bindable props, and authored documentation so the docs view can show the public API in the same terms as the component source. (See code/…/api-description.ts• L9-62.)
The Svelte path also handles projects with no matching configuration and components outside the configured file set. This keeps docs useful in linked or partial projects while preserving the component paths that Storybook reports to users. (See code/…/generate-docgen.ts• L235-285 and code/…/svelte-project-manager.ts• L67-115.)
References: code/…/preset.ts• L33-59 code/…/preset.ts• L7-20 code/…/preset.ts• L28-41 code/…/preset.ts• L9-21 code/…/resolveComponents.ts• L34-51 code/…/resolveComponents.ts• L82-202 code/…/build-docgen.ts• L123-182 code/…/build-docgen.ts• L185-239 code/…/preset.ts• L18-26 code/…/framework-preset-react-docs.ts• L13-23 code/…/preset.ts• L27-39 code/…/preset.ts• L28-45 code/…/buildDocgen.ts• L34-158 code/…/preset.ts• L39-52 code/…/preset.ts• L150-163 code/…/docgen-worker.ts• L7-32 code/…/svelte-project-manager.ts• L31-45 code/…/build-docgen.ts• L32-90 code/…/api-description.ts• L9-62 code/…/generate-docgen.ts• L235-285 code/…/svelte-project-manager.ts• L67-115
Related pages
Use the child pages for the contracts of each integration layer:
- Vite and Webpack builders explains builder setup, development mode, and production builds.
- Framework packages explains framework-specific presets and application rules.
- Renderer packages explains renderer APIs and story mounting.
- Webpack presets explains reusable React and server Webpack layers.
Change checklist
When these files or sections are changed, remember to consider these:
- Update the framework-to-builder and framework-to-renderer mappings together when adding or renaming a framework.
- Check that the framework
corepreset still points to a compatible builder and renderer package. - Check that builder presets still apply framework overrides after the default configuration and before final output.
- Check that preview annotations and renderer entry points agree on docs and metadata modes.
- Check that server-side docgen and builder-side docgen cannot both inject metadata for the same renderer.
- Check that React component and subcomponent resolution follows the same import, namespace, and re-export rules in manifests and docgen.
- Check that Vue primary and subcomponent docgen entries share the same re-export, API, and error-shape contract.
- Check that React server docgen preserves raw component metadata while also producing normalized
argTypesfor the component and each usable subcomponent. - Check that React docgen provider API support and the configured TypeScript package remain aligned with the renderer's supported docgen paths.
- Check that React Vite loads optional builder docgen packages only for builder-side docgen and keeps JavaScript and TypeScript coverage aligned with the selected mode.
- Check that Angular workspace roots, style inputs, aliases, and production metadata remain aligned across Vite paths.
- Check that Angular compiler transforms still run in an order that preserves Storybook mock behavior.
- Check that Angular start and build schemas expose the options supported by their matching builder, including the CLI-sensitive order of union types.
- Check that Angular Vite's deprecated Compodoc options remain marked as no-op while the Webpack integration keeps its supported metadata options.
- Check that Angular story reuse, teardown, selector normalization, and zoneless options stay aligned across the Vite and Angular beta renderers.
- Check that framework and renderer package peer ranges remain compatible with the builder package's supported tool versions.
- Check that Webpack mock resolution covers both module systems and watches redirected mock files.
- Check that React dependencies resolve to the same project copies in the builder and renderer, including renderer aliases and Vite dependency optimization.
- Check that Vite user-config loading,
viteConfigPathbehavior, andviteFinalpreserve the boundary between application settings and Storybook's build entry points. - Check that Vite stats keep normal imports, dynamic imports, virtual modules, and requested watch files connected for downstream change-impact tools.
- Check that Svelte story transforms preserve user preprocessors, runtime resolution, story CSS, TypeScript source offsets, and API metadata together.
- Check that Svelte runtime story inheritance keeps content, args, child mode, and play functions in the same story scope.
- Check that SvelteKit's aliases, preview annotations, production static assets, and mock exports remain aligned.
- Check that SvelteKit mock resets, form results, link interception, and docs-page isolation use the same story lifecycle.
- Check that development and production paths preserve the same framework assets and application aliases.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The framework value is missing | Storybook cannot select a framework integration | Require a framework in the main configuration before resolving the builder or renderer. |
| A framework maps to the wrong builder or renderer | The preview may build but cannot mount stories correctly | Keep the framework mapping and the framework core preset aligned. |
| A framework override replaces the base builder config | Application rules or Storybook preview entries disappear | Extend the incoming config through the preset chain. |
| Server-side docgen is enabled while build-time docgen still injects metadata | Preview metadata can be duplicated or disagree with the docs service | Make builder and renderer docgen presets use the same feature mode. |
| React component metadata points to an export that a re-export chain does not provide | The primary component or a declared subcomponent is missing from docs metadata | Resolve the declaration through the module graph and report the unresolved export. |
| React server docgen uses a TypeScript API or package that its provider cannot resolve | Component metadata or arg types are missing from the docs output | Keep the selected docgen TypeScript package within the provider's supported APIs and pass the Storybook config context to extraction. |
| React server docgen exposes raw component metadata without renderer conversion | Args tables cannot use the component metadata in the expected shape | Add normalized argTypes for the component and each usable subcomponent. |
| Angular start or build schemas drift from the matching builder | Angular CLI options are rejected, ignored, or passed with the wrong type | Keep each schema aligned with its builder and validate the shared log levels and statsJson union order. |
| Angular Vite receives legacy Compodoc settings as if they still run | Users expect metadata work that the Vite path no longer performs | Keep the options explicitly deprecated and use the in-process metadata path. |
| Angular zoneless rendering is enabled on an unsupported Angular version | Story bootstrap fails before the component renders | Use the Vite provider only on its supported path and keep the Angular beta version check. |
| Angular style inputs or preprocessors do not resolve from the workspace | The preview fails to build styles or loses application-wide styles | Resolve style paths from the Angular workspace and report the required preprocessor before Vite fails. |
| Angular's compiler emits code after Storybook's mock transform | Mock declarations disappear from the compiled module | Reapply redirects and automocks after the framework transform. |
| A Webpack mock resolves differently for import and require | A story uses the real module in one path and the mock in another | Resolve mock targets through Webpack for both module systems. |
| React dependencies resolve to different copies in the builder and renderer | Hooks or context can fail at runtime, or browser module loading can fail | Keep the renderer's React aliases and Vite dependency optimization on the same project copies. |
| A Svelte story runtime import reaches Vite's optimizer first | The page can reload or load a second runtime copy during story startup | Resolve the Storybook runtime before normal Vite resolution. |
| A Svelte story file cannot mount its story collector | The runtime story set is empty and the mount error is logged | Keep the collector mount and runtime story extraction in the same Svelte-compatible path. |
| TypeScript Svelte markup is parsed without a source offset | Story edits target the wrong source positions | Add the temporary TypeScript script and map parsed positions back to the original markup. |
| A Svelte component or imported type changes without a fresh project view | Docs show old props or fail to resolve new components | Refresh the project when files change and when a component save occurs before metadata extraction. |
| A Vue re-export has no matching component metadata | The primary docs entry reports a docgen error or a child entry records its own error | Follow the re-export to the declaring component and isolate child extraction failures. |
| A SvelteKit story sets shared mock state while another inline docs story is setting up | The docs page could show one story's state in another | Throw the shared-mock error and use separate iframes for stories with different setup. |
| A SvelteKit form result arrives after the story is destroyed | A later story receives stale page state | Abort pending submissions and ignore results after teardown. |
| A SvelteKit link is handled as a normal browser navigation | The story or Storybook page leaves the preview | Intercept same-window story links and report them through the navigation mock. |
| A renderer receives an unsupported story result | The canvas shows an error instead of the story | Return the output type required by the target renderer. |
Key files
| File | Why to read it |
|---|---|
| code/…/framework.ts | Maps frameworks to builders and renderers. |
| code/…/get-framework-name.ts | Normalizes the configured framework value. |
| code/…/presets.ts | Defines preset loading and ordered configuration composition. |
| code/…/index.ts | Shows the Vite development and production builder contract. |
| code/…/package.json | Defines the Vite builder package boundary and supported Vite peer range. |
| code/…/vite-config.ts | Shows user Vite config loading and the shared Vite config boundary. |
| code/…/webpack-stats-plugin.ts | Shows how Vite's graph becomes downstream-compatible build stats. |
| code/…/index.ts | Shows the Webpack configuration, compiler, and output contract. |
| code/…/package.json | Defines the Webpack 5 builder package boundary and preview dependencies. |
| code/…/webpack-mock-plugin.ts | Shows how Webpack applies preview mocks during module resolution. |
| code/…/preset.ts | Shows Angular workspace adaptation, styles, aliases, metadata modes, and Vite integration. |
| code/…/AbstractRenderer.ts | Shows Angular Vite story bootstrap, reuse, teardown, and selector handling. |
| code/…/start-schema.json and code/…/build-schema.json | Define the Angular Vite CLI contracts for development and production. |
| code/…/schemas.test.ts | Protects Angular Vite schema types and accepted log levels. |
| code/…/AbstractRenderer.ts | Shows Angular beta story bootstrap and experimental zoneless compatibility. |
| code/…/schemas.test.ts | Protects the Webpack Angular schema log-level contract. |
| code/…/start-schema.json and code/…/build-schema.json | Define the Angular Webpack CLI contracts for development and production. |
| code/…/preset.ts | Shows React's Vite selection and the split between server and builder docgen. |
| code/…/preset.ts | Shows Vue template and metadata adaptation on Vite. |
| code/…/preset.ts | Shows Svelte story transforms, framework handling, and metadata mode selection. |
| code/…/svelte-csf.ts | Shows how Svelte story files enter the CSF and Vite pipeline. |
| code/…/preset.ts | Shows SvelteKit's Vite, asset, server-module, and mock adaptation. |
| code/…/preview.ts | Shows per-story SvelteKit mock setup, reset, and docs lifecycle. |
| code/…/docs-isolation.ts | Shows how shared mock state is guarded on docs pages. |
| code/…/forms.ts | Shows the browser-safe SvelteKit form flow used by stories. |
| code/…/navigation.ts | Shows the navigation API and link mock contract. |
| code/…/app-state-mock.svelte.js | Shows the mocked reactive SvelteKit page state. |
| code/…/preset.ts | Shows application-specific adaptation on top of Webpack. |
| code/…/framework-preset-react-docs.ts | Shows React metadata adaptation for Webpack. |
| code/…/package.json and code/…/package.json | Define the reusable React and server Webpack preset package boundaries. |
| code/…/preset.ts | Shows React preview annotations, dependency alignment, TypeScript docgen selection, and metadata modes. |
| code/…/resolveComponents.ts | Shows shared React component, subcomponent, import, and re-export resolution. |
| code/…/docgen-typescript-apis.ts | Defines the TypeScript APIs supported by React docgen. |
| code/…/buildDocgen.ts | Shows how React server metadata becomes the shared docs payload and UI arg types. |
| code/…/preset.ts | Shows Vue preview annotations and metadata services. |
| code/…/build-docgen.ts | Shows Vue primary and subcomponent metadata extraction and error isolation. |
| code/…/preset.ts | Shows Svelte preview annotations and story indexing services. |
| code/…/create-runtime-stories.ts | Shows how Svelte story declarations become runtime CSF stories. |
| code/…/markup.ts | Shows Svelte story-markup parsing and source edit handling. |
| code/…/preset.ts | Shows Web Components preview annotations and manifest support. |
| code/…/render.tsx | Shows the basic component rendering contract. |
| code/…/render.ts | Shows framework app mounting and reactive updates. |
| code/…/transform.ts | Shows how source and compiled Svelte story data become CSF output. |
| code/…/docgen-worker.ts | Shows the worker boundary for Svelte component metadata. |
| code/…/build-docgen.ts | Shows how Svelte component and subcomponent metadata becomes a docs payload. |
| code/…/api-description.ts | Shows how Svelte component API types become docs output. |
| code/…/svelte-project-manager.ts | Shows how Svelte project metadata stays current across file changes. |