import assert from 'assert' ; import { ConfigPlugin , StaticPlugin } from '../Plugin.types' ; import { withStaticPlugin } from './withStaticPlugin' ; param config param plugins export const withPlugins = ( config , plugins ) => { assert ( Array . isArray ( plugins ) , 'withPlugins expected a valid array of plugins or plugin module paths' ) ; return plugins . reduce ( ( prev , plugin ) => withStaticPlugin ( prev , { plugin } ) , config ) ; } ;