diff --git a/code/builders/builder-vite/src/codegen-modern-iframe-script.ts b/code/builders/builder-vite/src/codegen-modern-iframe-script.ts index c43686fd248d..7a17d5642447 100644 --- a/code/builders/builder-vite/src/codegen-modern-iframe-script.ts +++ b/code/builders/builder-vite/src/codegen-modern-iframe-script.ts @@ -14,7 +14,7 @@ export async function generateModernIframeScriptCode(options: Options, projectRo [], options ); - const [previewFileUrl, ...previewAnnotationURLs] = [...previewAnnotations, previewOrConfigFile] + const [previewFileUrl, ...previewAnnotationURLs] = [previewOrConfigFile, ...previewAnnotations] .filter(Boolean) .map((path) => processPreviewAnnotation(path, projectRoot)); diff --git a/code/renderers/react/src/preview.tsx b/code/renderers/react/src/preview.tsx index 8cd9c5cec2d2..a43f89a59587 100644 --- a/code/renderers/react/src/preview.tsx +++ b/code/renderers/react/src/preview.tsx @@ -10,10 +10,15 @@ import type { StoryAnnotations, } from 'storybook/internal/types'; +import * as reactAnnotations from './entry-preview'; +import * as reactDocsAnnotations from './entry-preview-docs'; import type { ReactRenderer } from './types'; export function defineConfig(config: PreviewConfigData) { - return new PreviewConfig(config); + return new PreviewConfig({ + ...config, + addons: [reactAnnotations, reactDocsAnnotations, ...(config.addons ?? [])], + }); } interface PreviewConfigData extends ProjectAnnotations {