You do not need to create RegExp to filter files with main-bower-files .
In fact, you can just pass an array or a glob string to check for .js files only:
gulp.task('default', function () { var bowerFiles = mainBowerFiles('**/*.js'); console.log('bower files: ', bowerFiles); });
If you really want to use a regular expression, you need to use the filter parameter, you cannot pass it as an argument directly:
gulp.task('default', function () { var bowerFiles = mainBowerFiles({ filter: new RegExp('.*js$', 'i') }); console.log('bower files: ', bowerFiles); });
source share