capaj / require-globify

transform for browserify, which allows to require files with globbing expressions
MIT License
70 stars 11 forks source link

Glob without resolving #31

Open pmelisko opened 7 years ago

pmelisko commented 7 years ago

Hi, I have a question about "resolve". I just want globbed files. I thought, this will work: require('./includes/*.js', {mode: 'expand'}); but internally it will use default resolve functions ["path-reduce", "strip-ext"]. If I dont want to use any resolving function I need to write my own resolve function, i.e: resolve:(base,files)=>files, or simply use empty array []. require('./includes/*.js', {mode: 'expand', resolve:[]}); require('./includes/*.js', {mode: 'expand', resolve:(base,files)=>files});

My questions: 1) is empty array a hack? I think it should return defaults. 2) what is the correct approach to omit any resolving functions

Thanks in advance

call-a3 commented 7 years ago

I think both options are valid. I decided on the current default because I thought that would be the most-wanted behaviour. Your solutions to circumvent that both seem valid to me. Personally I'd prefer the empty array in your case, because it more accurately fits what you want (no resolvers)