Skip to content

Commit 1ef5748

Browse files
Merge pull request #28756 from storybookjs/valentin/rsc-portable-stories-compat
Next.js: Make RSC portable-stories compatible
2 parents 61b8fc3 + d271575 commit 1ef5748

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

code/frameworks/nextjs/src/portable-stories.ts

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {
1616

1717
// ! ATTENTION: This needs to be a relative import so it gets prebundled. This is to avoid ESM issues in Nextjs + Jest setups
1818
import { INTERNAL_DEFAULT_PROJECT_ANNOTATIONS as reactAnnotations } from '../../../renderers/react/src/portable-stories';
19+
import * as rscAnnotations from '../../../renderers/react/src/entry-preview-rsc';
1920
import * as nextJsAnnotations from './preview';
2021

2122
import type { ReactRenderer, Meta } from '@storybook/react';
@@ -46,6 +47,7 @@ export function setProjectAnnotations(
4647
// This will not be necessary once we have auto preset loading
4748
const defaultProjectAnnotations: ProjectAnnotations<ReactRenderer> = composeConfigs([
4849
reactAnnotations,
50+
rscAnnotations,
4951
nextJsAnnotations,
5052
]);
5153

code/renderers/react/src/preset.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ export const previewAnnotations: PresetProperty<'previewAnnotations'> = async (
1111
options
1212
) => {
1313
const docsConfig = await options.presets.apply('docs', {}, options);
14+
const features = await options.presets.apply('features', {}, options);
1415
const docsEnabled = Object.keys(docsConfig).length > 0;
1516
const result: string[] = [];
1617

1718
return result
1819
.concat(input)
1920
.concat([join(__dirname, 'entry-preview.mjs')])
2021
.concat(docsEnabled ? [join(__dirname, 'entry-preview-docs.mjs')] : [])
21-
.concat(FEATURES?.experimentalRSC ? [join(__dirname, 'entry-preview-rsc.mjs')] : []);
22+
.concat(features?.experimentalRSC ? [join(__dirname, 'entry-preview-rsc.mjs')] : []);
2223
};
2324

2425
/**

0 commit comments

Comments
 (0)