generate-examples-index-webpack-plugin
Version:
Generate an examples index page from your examples folder
24 lines (20 loc) • 689 B
JavaScript
/**
* Given an original configuration (can be undefined) and a list of files, return the webpack configuration
* to use to exclude those files from the build stats information
*
* @param {*} original Original excludeAssets webpack configuration
* @param {string[]} files List of files to exclude
*/
function getExcludeAssets(original, files) {
const filter = (assetName) => files.indexOf(assetName) === -1;
let excludeAssets;
if (!original) {
excludeAssets = filter;
} else if (Array.isArray(original)) {
excludeAssets = original.concat([filter]);
} else {
excludeAssets = [original, filter];
}
return excludeAssets;
}
module.exports = getExcludeAssets;