From ac879248fcca28724000ff5f6c2ffcebfca060f8 Mon Sep 17 00:00:00 2001 From: Tommy Date: Sun, 5 Feb 2017 11:29:13 -0500 Subject: [PATCH] fix: Add only directories in a glob root config (#120) --- src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index d9263f3..2cffd1f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ import path from 'path'; +import fs from 'fs'; import glob from 'glob'; import findBabelConfig from 'find-babel-config'; import getRealPath from './getRealPath'; @@ -28,7 +29,9 @@ export function manipulatePluginOptions(pluginOpts) { // eslint-disable-next-line no-param-reassign pluginOpts.root = pluginOpts.root.reduce((resolvedDirs, dirPath) => { if (glob.hasMagic(dirPath)) { - return resolvedDirs.concat(glob.sync(dirPath)); + return resolvedDirs.concat( + glob.sync(dirPath).filter(p => fs.lstatSync(p).isDirectory()), + ); } return resolvedDirs.concat(dirPath); }, []);