npm@3 has been stable for a few months now and one the big changes was the new flat(ter) directory structure inside
node_modules. This blog post has a good writeup of why that’s a good thing.
You’ll notice that I said “flat(ter)” above. If two modules in your project have conflicting dependencies, then one of those will end up on the top level of
node_modules and the other will be nested inside its parent’s
node_modules directory. This got me to wondering, which ones ends up on the top level?
I was wondering this because of a discussion on the eslint issue tracker about if the new directory structure will allow you to
require a nested dependency now that it is at the top level of
node_modules. As the linked comment pointed out, it will let you, but that doesn’t mean you should do it. If you did depend on this functionality, you would be requiring a module without any guarantee of what version you would be getting back.