@@ -33,6 +33,7 @@ opts.require.forEach(function (module) {
3333} ) ;
3434
3535var resolvePath = require ( 'path' ) . resolve ;
36+ var requireResolve = require . resolve ;
3637
3738var matcher ;
3839if ( typeof opts . ignore === 'string' ) {
@@ -50,19 +51,22 @@ if (typeof opts.ignore === 'string') {
5051var glob = require ( 'glob' ) ;
5152
5253var files = opts . _ . reduce ( function ( result , arg ) {
53- // If glob does not match, `files` will be an empty array.
54- // Note: `glob.sync` may throw an error and crash the node process.
55- var globFiles = glob . sync ( arg ) ;
54+ if ( glob . hasMagic ( arg ) ) {
55+ // If glob does not match, `files` will be an empty array.
56+ // Note: `glob.sync` may throw an error and crash the node process.
57+ var globFiles = glob . sync ( arg ) ;
5658
57- if ( ! Array . isArray ( globFiles ) ) {
58- throw new TypeError ( 'unknown error: glob.sync("' + arg + '") did not return an array or throw. Please report this.' ) ;
59- }
59+ if ( ! Array . isArray ( globFiles ) ) {
60+ throw new TypeError ( 'unknown error: glob.sync("' + arg + '") did not return an array or throw. Please report this.' ) ;
61+ }
6062
61- return result . concat ( globFiles ) ;
63+ return result . concat ( globFiles ) ;
64+ }
65+ return result . concat ( arg ) ;
6266} , [ ] ) . filter ( function ( file ) {
6367 return ! matcher || ! matcher . shouldIgnore ( file ) ;
6468} ) . map ( function ( file ) {
65- return resolvePath ( cwd , file ) ;
69+ return requireResolve ( resolvePath ( cwd , file ) ) ;
6670} ) ;
6771
6872var hasImport = require ( 'has-dynamic-import' ) ;
0 commit comments