Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (storybookBaseConfig, configType) => {
const storybookConfig = genStorybookDefaultConfig(
storybookBaseConfig,
configType
);
return {
...vueConfig, // use vue's webpack configuration by default
entry: storybookConfig.entry, // overwite entry
output: storybookConfig.output, // overwrite output
// remove duplicated plugins
plugins: merge({
customizeArray: merge.unique(
"plugins",
[
"HotModuleReplacementPlugin",
"CaseSensitivePathsPlugin",
"WatchMissingNodeModulesPlugin"
],
plugin => plugin.constructor && plugin.constructor.name
)
})(vueConfig, storybookConfig).plugins,
resolve: {
...vueConfig.resolve,
alias: {
...vueConfig.resolve.alias,
vue$: storybookConfig.resolve.alias.vue$
}
}
};
const IGNORE_PLUGINS = [
'CommonsChunkPlugins',
'MiniHtmlWebpackPlugin',
'HtmlWebpackPlugin',
'OccurrenceOrderPlugin',
'DedupePlugin',
'UglifyJsPlugin',
'TerserPlugin',
'HotModuleReplacementPlugin',
];
const merge = mergeBase({
// Ignore user’s plugins to avoid duplicates and issues with our plugins
customizeArray: mergeBase.unique(
'plugins',
IGNORE_PLUGINS,
(plugin: Tapable.Plugin) => plugin.constructor && plugin.constructor.name
),
});
type MetaConfig = Configuration | ((env?: string) => Configuration);
/**
* Merge two Webpack configs.
*
* In the user config:
* - Ignores given sections (options.ignore).
* - Ignores plugins that shouldn’t be used twice or may cause issues.
*
* @param {object} baseConfig
removePlugins: ['plugins']
}
const IGNORE_PLUGINS = [
'CommonsChunkPlugins',
'MiniHtmlWebpackPlugin',
'HtmlWebpackPlugin',
'OccurrenceOrderPlugin',
'DedupePlugin',
'UglifyJsPlugin',
'HotModuleReplacementPlugin'
]
const merge = mergeBase({
// Ignore user’s plugins to avoid duplicates and issues with our plugins
customizeArray: mergeBase.unique(
'plugins',
IGNORE_PLUGINS,
(plugin: Plugin) => plugin.constructor && plugin.constructor.name
)
})
//make it a typeguard
function isFunc(
conf: Configuration | ((env: string) => Configuration)
): conf is ((env: string) => Configuration) {
return isFunction(conf)
}
/**
* Merge two Webpack configs.
*