const crossEnvSlash = '[\\/]' ; const nodeModules = `${ crossEnvSlash }node_modules${ crossEnvSlash }` ; const escape = ( dep ) => dep . replace ( '/' , '\\/' ) ; /** Create a string regexp from a list of dependencies */ export function getBabelLoaderIgnoreRegex ( dependencies ) { return `/[\\\\/]node_modules[\\\\/](?!(${ dependencies . map ( escape ) . join ( '|' ) })[\\\\/])/` ; } param dependencies export function buildIncludeRegexp ( dependencies ) { return new RegExp ( `${ nodeModules }?(${ dependencies . map ( escape ) . join ( '|' ) })${ crossEnvSlash }` ) ; } param dependencies export function buildExcludeRegexp ( dependencies ) { return new RegExp ( `${ nodeModules }(?!(${ dependencies . map ( escape ) . join ( '|' ) })${ crossEnvSlash })` ) ; }