lib/cluster_process.js
function extendResolvePath(basedir) {
    // using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO
    module.paths.push(basedir);

    const _basedir = basedir.split('/'),
        size = basedir.length;
    let i = 0;

    while (size > i++) {
        const modulesPath = _basedir.slice(0, i).join('/') + '/node_modules';

        if (module.paths.indexOf(modulesPath) === -1) {
            module.paths.push(modulesPath);
        }
    }
}
function extendResolvePath(basedir) {
    // using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO
    module.paths.push(basedir);

    const _basedir = basedir.split('/'),
        size = basedir.length;
    let i = 0;

    while (size > i++) {
        const modulesPath = _basedir.slice(0, i).join('/') + '/node_modules';

        if (module.paths.indexOf(modulesPath) === -1) {
            module.paths.push(modulesPath);
        }
    }
}
function extendResolvePath ( basedir ) { // using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO module . paths . push ( basedir ) ; const _basedir = basedir . split ( '/' ) , size = basedir . length ; let i = 0 ; while ( size > i ++ ) { const modulesPath = _basedir . slice ( 0 , i ) . join ( '/' ) + '/node_modules' ; if ( module . paths . indexOf ( modulesPath ) === - 1 ) { module . paths . push ( modulesPath ) ; } } }
Add `basedir`, `node_modules` contained in the `basedir` and its ancestors to `module.paths`
@param {String} basedir
Add basedir node_modules contained in the basedir and its ancestors to module . paths