Skip to content

Commit

Permalink
feat: update storybook, uninstall unused dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
TomatoVan committed Mar 29, 2024
1 parent 6db26f9 commit f28786f
Show file tree
Hide file tree
Showing 8 changed files with 1,597 additions and 1,490 deletions.
21 changes: 0 additions & 21 deletions config/storybook/main.js

This file was deleted.

67 changes: 67 additions & 0 deletions config/storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { Configuration, DefinePlugin, RuleSetRule } from 'webpack';
import path from 'path';
import { buildCssLoader } from '../build/loaders/buildCssLoader';
/* eslint-disable no-mixed-spaces-and-tabs */

export default {
stories: [
'../../src/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-links',
{
name: '@storybook/addon-essentials',
options: {
backgrounds: false,
},
},
'@storybook/addon-interactions',
'storybook-addon-mock',
'storybook-addon-themes',
],
framework: '@storybook/react',
core: {
builder: 'webpack5',
},
webpackFinal: async (config: Configuration) => {
const paths = {
build: '',
html: '',
entry: '',
src: path.resolve(__dirname, '..', '..', 'src'),
locales: '',
buildLocales: '',
};
config!.resolve!.modules!.push(paths.src);
config!.resolve!.extensions!.push('.ts', '.tsx');
config!.resolve!.alias = {
...config!.resolve!.alias,
'@': paths.src,
};

// @ts-ignore
config!.module!.rules = config!.module!.rules!.map((rule: RuleSetRule) => {
if (/svg/.test(rule.test as string)) {
return { ...rule, exclude: /\.svg$/i };
}

return rule;
});

config!.module!.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
config!.module!.rules.push(buildCssLoader(true));

config!.plugins!.push(
new DefinePlugin({
__IS_DEV__: JSON.stringify(true),
__API__: JSON.stringify('https://testapi.ru'),
__PROJECT__: JSON.stringify('storybook'),
}),
);
// Return the altered config
return config;
},
};
46 changes: 0 additions & 46 deletions config/storybook/webpack.config.ts

This file was deleted.

Loading

0 comments on commit f28786f

Please sign in to comment.