import { compact } from 'lodash' ; import { RuleSetUseItem } from 'webpack' ; import { BuildEntry , LoaderType } from '@reskript/settings' ; import * as loaders from '../loaders' ; export const introduceLoader = ( name , entry ) : RuleSetUseItem | null => { const factory = loaders [ name ] ; return factory ( entry ) ; } ; export const introduceLoaders = ( names , entry ) : RuleSetUseItem [ ] => { return compact ( compact ( names ) . map ( v => introduceLoader ( v , entry ) ) ) ; } ;