mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 05:21:06 +08:00
28 lines
848 B
Plaintext
28 lines
848 B
Plaintext
---
|
|
title: 'previewAnnotations'
|
|
sidebar:
|
|
order: 15
|
|
title: previewAnnotations
|
|
---
|
|
|
|
Parent: [main.js|ts configuration](./main-config.mdx)
|
|
|
|
Type: `string[] | ((config: string[], options: Options) => string[] | Promise<string[]>)`
|
|
|
|
Add additional scripts to run in the story preview.
|
|
|
|
<Callout variant="info" icon="💡">
|
|
Mostly used by [frameworks](../../contribute/framework.mdx#previewjs-example). Storybook users and [addon authors](../../addons/writing-presets.mdx) should add scripts to [`preview.js`](../../configure/index.mdx#configure-story-rendering) instead.
|
|
</Callout>
|
|
|
|
```ts
|
|
// @storybook/nextjs framework's src/preset.ts
|
|
|
|
import type { StorybookConfig } from './types';
|
|
|
|
export const previewAnnotations: StorybookConfig['previewAnnotations'] = (entry = []) => [
|
|
...entry,
|
|
require.resolve('@storybook/nextjs/preview.js'),
|
|
];
|
|
```
|