Created
April 29, 2016 17:36
-
-
Save myndzi/b556a5dacee2514f11e2c43b3fb9adfe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project/node_modules/loader - can require('foo') but not require('bar') | |
project/node_modules/foo | |
project/node_modules/foo/node_modules/bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you for some reason needed to load 'bar' from 'loader', you could potentially do it like this:
foo.js:
module.exports.loadChild = function (str) { return require('str'); }
loader.js:
require('foo').loadChild('bar');
...but the better solution is to make 'bar' a direct dependent of 'project'