2023-11-02 13:01:42 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
const path = require( 'path' );
|
|
|
|
|
2020-01-30 20:59:14 +00:00
|
|
|
module.exports = {
|
|
|
|
stories: [
|
|
|
|
// WooCommerce Blocks stuff (anywhere in repo!)
|
2023-11-02 13:01:42 +00:00
|
|
|
'../assets/js/**/stories/*.stories.@(js|jsx|ts|tsx)',
|
|
|
|
'../packages/**/stories/*.stories.@(js|jsx|ts|tsx)',
|
|
|
|
'../assets/js/**/*.mdx',
|
2023-11-20 12:53:41 +00:00
|
|
|
'../packages/**/*.mdx',
|
2020-01-30 20:59:14 +00:00
|
|
|
],
|
|
|
|
addons: [
|
2021-12-01 11:28:27 +00:00
|
|
|
'@storybook/addon-essentials',
|
2023-11-02 13:01:42 +00:00
|
|
|
'@storybook/addon-docs',
|
2020-01-30 20:59:14 +00:00
|
|
|
'@storybook/addon-a11y',
|
|
|
|
'@storybook/addon-links',
|
2021-12-01 11:28:27 +00:00
|
|
|
'storybook-addon-react-docgen',
|
2023-11-02 13:01:42 +00:00
|
|
|
'@storybook/addon-styling-webpack',
|
2020-01-30 20:59:14 +00:00
|
|
|
],
|
2023-11-02 13:01:42 +00:00
|
|
|
typescript: {
|
|
|
|
reactDocgen: 'react-docgen-typescript-plugin',
|
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
autodocs: true,
|
|
|
|
defaultName: 'Docs',
|
|
|
|
},
|
2021-12-01 11:28:27 +00:00
|
|
|
features: {
|
|
|
|
babelModeV7: true,
|
2021-12-15 16:03:02 +00:00
|
|
|
emotionAlias: false,
|
2021-12-01 11:28:27 +00:00
|
|
|
},
|
2023-09-20 20:31:52 +00:00
|
|
|
core: {
|
|
|
|
builder: 'webpack5',
|
|
|
|
},
|
2022-10-31 11:23:22 +00:00
|
|
|
// webpackFinal field was added in following PR: https://github.com/woocommerce/woocommerce-blocks/pull/7514
|
|
|
|
// This fixes "storybook build issue" related to framer-motion library.
|
2024-08-19 12:57:38 +00:00
|
|
|
// Solution is from this comment: https://github.com/storybookjs/storybook/issues/16690#issuecomment-971579785
|
2022-10-31 11:23:22 +00:00
|
|
|
webpackFinal: async ( config ) => {
|
|
|
|
config.module.rules.push( {
|
|
|
|
test: /\.mjs$/,
|
|
|
|
include: /node_modules/,
|
|
|
|
type: 'javascript/auto',
|
|
|
|
} );
|
2023-11-02 13:01:42 +00:00
|
|
|
// https://github.com/storybookjs/storybook/discussions/22650#discussioncomment-6414161
|
|
|
|
config.resolve.alias = {
|
|
|
|
...config.resolve.alias,
|
2024-09-26 07:10:37 +00:00
|
|
|
'react/jsx-runtime': require.resolve( 'react/jsx-runtime' ),
|
2023-11-02 13:01:42 +00:00
|
|
|
react: path.resolve( __dirname, '../node_modules/react' ),
|
|
|
|
'react-dom': path.resolve( __dirname, '../node_modules/react-dom' ),
|
|
|
|
};
|
2022-10-31 11:23:22 +00:00
|
|
|
return config;
|
|
|
|
},
|
2023-11-02 13:01:42 +00:00
|
|
|
framework: {
|
|
|
|
name: '@storybook/react-webpack5',
|
|
|
|
options: {},
|
|
|
|
},
|
2020-01-30 20:59:14 +00:00
|
|
|
};
|