browserify / browser-resolve

resolve function which support the browser field in package.json
MIT License
102 stars 70 forks source link

support recursivity in paths option #42

Closed slorber closed 10 years ago

slorber commented 10 years ago

See http://stackoverflow.com/a/23608416/82609

Imagine I have the following directory structure

/js/module1.js
/js/module2.js
/js/dir1/module3.js
/js/dir2/module4.js

I want to be able to do: require("module1"); require("module2"); require("module3"); require("module4");

With browserify, I have to use:

browserify(
  './app', 
  {
    paths: [
      './js',
      './js/dir1',
      './js/dir2',
    ]
  }
);

This is annoying because I have to maintain a list of all js directories inside my build

Is there anything we could do?

The other solution would be to use:

require("module1"); require("module2"); require("dir1/module3"); require("dir2/module4");

which is not so bad anyway

defunctzombie commented 10 years ago

Will not be supported. This is not how node loads modules and thus not how we will resolve them unfortunately. This module aims to be compatible with how node does module lookup with the added feature of replacing browser mappings and that is all.

/cc @substack

slorber commented 10 years ago

ok no problem thanks anyway :)