Skip to content

Commit

Permalink
modify configs and improve build chunking
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed May 4, 2022
1 parent c0e9f2a commit bea2a57
Show file tree
Hide file tree
Showing 6 changed files with 496 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-storybook-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
- name: Install and build
run: |
npm ci
npm run storybook-build
npm run storybook:build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.3.3
with:
branch: gh-pages
folder: storybook-static
folder: .storybook-dist
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
node_modules
dist
/Icon?
/graphics

/storybook-static
/graphics
/.storybook-dist
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules/
package-lock.json

graphics/
storybook-static/
.storybook-dist/
45 changes: 33 additions & 12 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
import {StorybookConfig} from '@storybook/core-common';

const storybookConfig: StorybookConfig = {
stories: [
'../src/**/*.stories.mdx',
'../src/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: '@storybook/react',
export const stories: StorybookConfig['stories'] = [
'../src/**/*.stories.mdx',
'../src/**/*.stories.@(js|jsx|ts|tsx)',
];
export const addons: StorybookConfig['addons'] = [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
];
export const framework: StorybookConfig['framework'] = '@storybook/react';

const maxAssetSize = 1024 * 1024;

export const webpackFinal: StorybookConfig['webpackFinal'] = (config) => {
config.optimization = {
...config.optimization,
splitChunks: {
...config.optimization?.splitChunks,
chunks: 'all',
minSize: 30 * 1024,
maxSize: maxAssetSize,
},
};
config.performance = {
...config.performance,
maxAssetSize: maxAssetSize,
};

return config;
};

export default storybookConfig;
export const features: StorybookConfig['features'] = {
/** Decrease bundle size */
storyStoreV7: true,
};
Loading

0 comments on commit bea2a57

Please sign in to comment.