-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathmain.js
40 lines (37 loc) · 1018 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const stories = [
process.env.NODE_ENV !== 'test' && './stories/**/*.(js|mdx)',
'../packages/block-editor/src/**/stories/*.js',
'../packages/components/src/**/stories/*.js',
'../packages/icons/src/**/stories/*.js',
].filter( Boolean );
const customEnvVariables = {
COMPONENT_SYSTEM_PHASE: 1,
};
module.exports = {
stories,
addons: [
{
name: '@storybook/addon-docs',
options: { configureJSX: true },
},
'@storybook/addon-knobs',
'@storybook/addon-storysource',
'@storybook/addon-viewport',
'@storybook/addon-a11y',
],
// Workaround:
// https://github.com/storybookjs/storybook/issues/12270
webpackFinal: async ( config ) => {
// Find the DefinePlugin
const plugin = config.plugins.find( ( p ) => {
return p.definitions && p.definitions[ 'process.env' ];
} );
// Add custom env variables
Object.keys( customEnvVariables ).forEach( ( key ) => {
plugin.definitions[ 'process.env' ][ key ] = JSON.stringify(
customEnvVariables[ key ]
);
} );
return config;
},
};