declare var require ; const store = { } ; const setStore = ( files , matchreg , exclude ? ) => { let fileNames = [ ] ; if ( exclude ) { fileNames = files . keys ( ) . filter ( ( item ) => item !== exclude ) ; } else { fileNames = files . keys ( ) ; } fileNames . map ( ( item ) => { const matchs = item . match ( matchreg ) ; if ( ! matchs || matchs . length < 2 ) { return false ; } const attr = matchs [ 1 ] ; store [ attr . toLocaleLowerCase ( ) ] = files ( item ) . default ; return true ; } ) ; } ; const globalContext = require . context ( './' , false , /\.ts$/ ) ; const commonContext = require . context ( '../containers' , true , /\.store.ts$/ ) ; setStore ( globalContext , /([^\/]+)\.ts$/ , './index.ts' ) ; setStore ( commonContext , /([^\/]+)\.store\.ts$/ ) ; console . log ( store ) ; export default store ;