|
| 1 | +--- |
| 2 | +title: 'core' |
| 3 | +--- |
| 4 | + |
| 5 | +Parent: [main.js|ts configuration](./main-config.md) |
| 6 | + |
| 7 | +Type: |
| 8 | + |
| 9 | +```ts |
| 10 | +{ |
| 11 | + builder?: string | { name: string; options?: BuilderOptions }; |
| 12 | + channelOptions?: ChannelOptions; |
| 13 | + crossOriginIsolated?: boolean; |
| 14 | + disableProjectJson?: boolean; |
| 15 | + disableTelemetry?: boolean; |
| 16 | + disableWebpackDefaults?: boolean; |
| 17 | + enableCrashReports?: boolean; |
| 18 | + renderer?: RendererName; |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +Configures Storybook's internal features. |
| 23 | + |
| 24 | +## `builder` |
| 25 | + |
| 26 | +Type: |
| 27 | + |
| 28 | +```ts |
| 29 | +| '@storybook/builder-vite' | '@storybook/builder-webpack5' |
| 30 | +| { |
| 31 | + name: '@storybook/builder-vite' | '@storybook/builder-webpack5'; |
| 32 | + options?: BuilderOptions; |
| 33 | + } |
| 34 | +``` |
| 35 | + |
| 36 | +Configures Storybook's builder, [Vite](../builders/vite.md) or [Webpack](../builders/webpack.md). |
| 37 | + |
| 38 | +<!-- prettier-ignore-start --> |
| 39 | + |
| 40 | +<CodeSnippets |
| 41 | + paths={[ |
| 42 | + 'common/main-config-core-builder.js.mdx', |
| 43 | + 'common/main-config-core-builder.ts.mdx', |
| 44 | + ]} |
| 45 | +/> |
| 46 | + |
| 47 | +<!-- prettier-ignore-end --> |
| 48 | + |
| 49 | +## `channelOptions` |
| 50 | + |
| 51 | +Type: `ChannelOptions` |
| 52 | + |
| 53 | +```ts |
| 54 | +{ |
| 55 | + allowClass: boolean; |
| 56 | + allowDate: boolean; |
| 57 | + allowFunction: boolean; |
| 58 | + allowRegExp: boolean; |
| 59 | + allowSymbol: boolean; |
| 60 | + allowUndefined: boolean; |
| 61 | + lazyEval: boolean; |
| 62 | + maxDepth: number; |
| 63 | + space: number | undefined; |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +Configures the channel used by Storybook to communicate between the manager and preview. |
| 68 | + |
| 69 | +Only two properties are likely to be used: |
| 70 | + |
| 71 | +### `channelOptions.allowFunction` |
| 72 | + |
| 73 | +Type: `boolean` |
| 74 | + |
| 75 | +Default: `false` |
| 76 | + |
| 77 | +Enables serializing functions across the channel, which can be a security risk. |
| 78 | + |
| 79 | +### `channelOptions.maxDepth` |
| 80 | + |
| 81 | +Type: `number` |
| 82 | + |
| 83 | +Default: `3` |
| 84 | + |
| 85 | +The maximum depth of nested objects to serialize across the channel. Larger values will be slower. |
| 86 | + |
| 87 | +## `crossOriginIsolated` |
| 88 | + |
| 89 | +Type: `boolean` |
| 90 | + |
| 91 | +Enable CORS headings to run document in a "secure context". See [SharedArrayBuffer security requirements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements) |
| 92 | + |
| 93 | +This enables these headers in development-mode: |
| 94 | + |
| 95 | +- `Cross-Origin-Opener-Policy: same-origin` |
| 96 | +- `Cross-Origin-Embedder-Policy: require-corp` |
| 97 | + |
| 98 | +<!-- prettier-ignore-start --> |
| 99 | + |
| 100 | +<CodeSnippets |
| 101 | + paths={[ |
| 102 | + 'common/main-config-core-cross-origin-isolated.js.mdx', |
| 103 | + 'common/main-config-core-cross-origin-isolated.ts.mdx', |
| 104 | + ]} |
| 105 | +/> |
| 106 | + |
| 107 | +<!-- prettier-ignore-end --> |
| 108 | + |
| 109 | +## `disableProjectJson` |
| 110 | + |
| 111 | +Type: `boolean` |
| 112 | + |
| 113 | +Disables the generation of `project.json`, a file containing Storybook metadata |
| 114 | + |
| 115 | +<!-- prettier-ignore-start --> |
| 116 | + |
| 117 | +<CodeSnippets |
| 118 | + paths={[ |
| 119 | + 'common/main-config-core-disable-project-json.js.mdx', |
| 120 | + 'common/main-config-core-disable-project-json.ts.mdx', |
| 121 | + ]} |
| 122 | +/> |
| 123 | + |
| 124 | +<!-- prettier-ignore-end --> |
| 125 | + |
| 126 | +## `disableTelemetry` |
| 127 | + |
| 128 | +Type: `boolean` |
| 129 | + |
| 130 | +Disables Storybook's [telemetry collection](../configure/telemetry.md). |
| 131 | + |
| 132 | +<!-- prettier-ignore-start --> |
| 133 | + |
| 134 | +<CodeSnippets |
| 135 | + paths={[ |
| 136 | + 'common/main-config-core-disable-telemetry.js.mdx', |
| 137 | + 'common/main-config-core-disable-telemetry.ts.mdx', |
| 138 | + ]} |
| 139 | +/> |
| 140 | + |
| 141 | +<!-- prettier-ignore-end --> |
| 142 | + |
| 143 | +## `disableWebpackDefaults` |
| 144 | + |
| 145 | +Type: `boolean` |
| 146 | + |
| 147 | +Disables Storybook's default Webpack configuration. |
| 148 | + |
| 149 | +<!-- prettier-ignore-start --> |
| 150 | + |
| 151 | +<CodeSnippets |
| 152 | + paths={[ |
| 153 | + 'common/main-config-core-disable-webpack-defaults.js.mdx', |
| 154 | + 'common/main-config-core-disable-webpack-defaults.ts.mdx', |
| 155 | + ]} |
| 156 | +/> |
| 157 | + |
| 158 | +<!-- prettier-ignore-end --> |
| 159 | + |
| 160 | +## `enableCrashReports` |
| 161 | + |
| 162 | +Type: `boolean` |
| 163 | + |
| 164 | +Enable crash reports to be sent to Storybook [telemetry](../configure/telemetry.md). |
| 165 | + |
| 166 | +<!-- prettier-ignore-start --> |
| 167 | + |
| 168 | +<CodeSnippets |
| 169 | + paths={[ |
| 170 | + 'common/main-config-core-enable-crash-reports.js.mdx', |
| 171 | + 'common/main-config-core-enable-crash-reports.ts.mdx', |
| 172 | + ]} |
| 173 | +/> |
| 174 | + |
| 175 | +<!-- prettier-ignore-end --> |
| 176 | + |
| 177 | +## `renderer` |
| 178 | + |
| 179 | +Type: `RendererName` |
| 180 | + |
| 181 | +<!-- TOOD: Is this used? Should it be documented? --> |
0 commit comments