code: function(id) {
    for (let parent = module.parent; parent; parent = parent.parent) {
      try {
        return parent.require(id);
      } catch (e) {}
    }
    throw new Error("Cannot find module '" + id + "' from parent");
  }
docs: from jaredhanson/node-parent-require