I think you'll need a second check here for ` && grunt.file.isFile(externalResolved))`. `exists` will return true on both directories and files, which can also both be returned from `grunt.file.expand`.