mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-01 05:05:25 +08:00
Environment vars changes
This commit is contained in:
parent
4e68732915
commit
9476e28433
@ -83,6 +83,7 @@ Additionally, you can extend your Storybook configuration file (i.e., [`.storybo
|
||||
<CodeSnippets
|
||||
paths={[
|
||||
'common/storybook-main-env-field-config.js.mdx',
|
||||
'common/storybook-main-env-field-config.ts.mdx',
|
||||
]}
|
||||
/>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// .storybook/main.js
|
||||
|
||||
module.exports = {
|
||||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
||||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
||||
addons: [
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-essentials',
|
||||
|
25
docs/snippets/common/storybook-main-env-field-config.ts.mdx
Normal file
25
docs/snippets/common/storybook-main-env-field-config.ts.mdx
Normal file
@ -0,0 +1,25 @@
|
||||
```ts
|
||||
// .storybook/main.ts
|
||||
|
||||
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-webpack5)
|
||||
import type { StorybookConfig } from '@storybook/your-framework';
|
||||
|
||||
const config: StorybookConfig = {
|
||||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
||||
addons: [
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-essentials',
|
||||
'@storybook/addon-interactions',
|
||||
],
|
||||
/*
|
||||
* 👇 The `config` argument contains all the other existing environment variables.
|
||||
* Either configured in an `.env` file or configured on the command line.
|
||||
*/
|
||||
env: (config) => ({
|
||||
...config,
|
||||
EXAMPLE_VAR: 'An environment variable configured in Storybook',
|
||||
}),
|
||||
};
|
||||
|
||||
export default config;
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user