2023-02-15 15:36:45 +03:00
|
|
|
import * as webpack from 'webpack';
|
|
|
|
import { merge } from 'webpack-merge';
|
|
|
|
export default {
|
2022-08-30 11:03:14 +03:00
|
|
|
addons: [
|
|
|
|
'@storybook/addon-links',
|
|
|
|
'@storybook/addon-interactions',
|
2023-05-09 20:39:48 +03:00
|
|
|
'@storybook/addon-a11y',
|
2023-02-15 15:36:45 +03:00
|
|
|
'storybook-addon-console-env',
|
2023-05-09 20:39:48 +03:00
|
|
|
'@storybook/addon-mdx-gfm',
|
2022-08-30 11:03:14 +03:00
|
|
|
],
|
2023-02-15 15:36:45 +03:00
|
|
|
webpackFinal: async (config: any) => {
|
2023-05-09 20:39:48 +03:00
|
|
|
const finalConfig = merge(config, {
|
2023-01-24 20:16:14 +03:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
__CLIENT__: 'true',
|
|
|
|
__SERVER__: false,
|
|
|
|
__DEVELOPMENT__: true,
|
2023-05-09 20:39:48 +03:00
|
|
|
__DEVTOOLS__: true,
|
|
|
|
// <-------- DISABLE redux-devtools HERE
|
2023-01-24 20:16:14 +03:00
|
|
|
CONSOLE_ASSET_VERSION: Date.now().toString(),
|
|
|
|
}),
|
|
|
|
// un comment this to test out the circular deps. Left here since it can be tricky to configure
|
|
|
|
],
|
2023-05-09 20:39:48 +03:00
|
|
|
|
2023-01-24 20:16:14 +03:00
|
|
|
resolve: {
|
|
|
|
fallback: {
|
|
|
|
fs: false,
|
|
|
|
os: false,
|
|
|
|
http: false,
|
2023-05-31 14:07:25 +03:00
|
|
|
https: require.resolve('https-browserify'),
|
2023-01-24 20:16:14 +03:00
|
|
|
path: require.resolve('path-browserify'),
|
|
|
|
crypto: false,
|
|
|
|
util: require.resolve('util/'),
|
|
|
|
stream: false,
|
2023-05-09 20:39:48 +03:00
|
|
|
url: false,
|
2023-01-24 20:16:14 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
2023-05-09 20:39:48 +03:00
|
|
|
finalConfig.module.rules = finalConfig.module.rules.map((rule: any) => {
|
2023-02-28 22:41:18 +03:00
|
|
|
if (/source-map-loader/.test(rule.loader)) {
|
|
|
|
return {
|
|
|
|
...rule,
|
|
|
|
exclude: /node_modules/, // we don't want source maps for vendors, because of graphiql
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (/file-loader/.test(rule.loader)) {
|
|
|
|
return {
|
|
|
|
...rule,
|
|
|
|
type: 'javascript/auto', // This is fixing issue https://webpack.js.org/guides/asset-modules/
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return rule;
|
|
|
|
});
|
2023-05-09 20:39:48 +03:00
|
|
|
return finalConfig;
|
|
|
|
},
|
|
|
|
framework: {
|
|
|
|
name: '@storybook/react-webpack5',
|
|
|
|
options: {},
|
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
autodocs: true,
|
2023-01-24 20:16:14 +03:00
|
|
|
},
|
2022-08-30 11:03:14 +03:00
|
|
|
};
|