23 lines
747 B
JavaScript

const webpack = require('webpack');
module.exports = (storybookBaseConfig, configType, defaultConfig) => {
// configType has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.
// Make whatever fine-grained changes you need
defaultConfig.plugins.push(
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
chunks: ['preview'],
minChunks: function (module) {
// this assumes your vendor imports exist in the node_modules directory
return module.context && module.context.indexOf("node_modules") !== -1;
},
})
);
// Return the altered config
return defaultConfig;
};