Does it do the right thing when NODE_PATHs is used?
cymen opened this issue · 2 comments
So there is a murky backwater in node such that you can set NODE_PATH in the environment to multiple directories. Say you had a file system structure like this:
$ tree
.
├── a
│ └── b
│ └── trolls
│ └── something.js
└── no
└── trolls
└── other.js
Then you could do NODE_PATH=a/b/trolls:no/trolls
and these things would work:
require('something.js');
require('other.js');
This is stinky. But it works. Obviously, collisions are imminent. It's a bad idea all around. But... occasionally, it is useful.
Would browserify-incremental do the right thing and use the paths to the files so that if you have a collision on the require name, the actual key in the cache file does not collide? I'll figure out how to try this soon but I wanted to ask in case you already knew.
Absolute filepaths on your filesystem are used as the cache key so that shouldn't be a problem. In fact, I wrote browserify-incremental to use with a large app which makes use of NODE_PATH
and had no issues with it (other than the collisions you mentioned, which are predictable but do add a bit of cognitive overhead for developers).
Awesome! Thank you.