Skip to content

Commit

Permalink
[DDW-980] Speedup storybook build performance in development
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikGuzei committed Oct 18, 2019
1 parent e24e3bd commit 8144a1c
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions storybook/webpack.config.js
@@ -1,8 +1,64 @@
const AutoDllPlugin = require('autodll-webpack-plugin');

const isCi = process.env.CI && process.env.CI !== '';

module.exports = async ({ config }) => {
const [jsxRule] = config.module.rules;
jsxRule.use.unshift('thread-loader');
// Use Auto DLL plugin for faster development builds
if (!isCi) {
const [htmlWebpackPlugin] = config.plugins;
const { templateParameters } = htmlWebpackPlugin.options;
htmlWebpackPlugin.options.templateParameters = (...args) =>
Object.assign(templateParameters.call(null, ...args), {
dlls: ['./vendor.dll.js'],
});
config.plugins.push(
new AutoDllPlugin({
inject: true,
filename: 'vendor.dll.js',
entry: {
vendor: [
'@storybook/addon-actions',
'@storybook/addon-knobs',
'@storybook/addon-links',
'@storybook/addon-notes',
'@storybook/addons',
'@storybook/core',
'@storybook/react',
'aes-js',
'bignumber.js',
'bip39',
'blakejs',
'bs58',
'classnames',
'es6-error',
'faker',
'humanize-duration',
'lodash',
'mobx',
'mobx-react',
'mobx-react-form',
'mobx-react-router',
'moment',
'pbkdf2',
'qrcode.react',
'react',
'react-copy-to-clipboard',
'react-dom',
'react-number-format',
'react-router',
'react-svg-inline',
'recharts',
'route-parser',
'safe-buffer',
'unorm',
'validator',
],
},
})
);
}
return {
...config,
cache: false,
Expand Down

0 comments on commit 8144a1c

Please sign in to comment.