webpack.config.js
function findNodeModules(cwd) {
  var parts = cwd.split(path.sep)
  while (parts.length > 0) {
    var target = path.join(parts.join(path.sep), 'node_modules')
    if (fs.existsSync(target)) {
      return target
    }
    parts.pop()
  }
}
function findNodeModules(cwd) {
  var parts = cwd.split(path.sep)
  while (parts.length > 0) {
    var target = path.join(parts.join(path.sep), 'node_modules')
    if (fs.existsSync(target)) {
      return target
    }
    parts.pop()
  }
}
function findNodeModules ( cwd ) { var parts = cwd . split ( path . sep ) while ( parts . length > 0 ) { var target = path . join ( parts . join ( path . sep ) , 'node_modules' ) if ( fs . existsSync ( target ) ) { return target } parts . pop ( ) } }
Find the node_modules directory which will be resolved from a given dir.
Find the node_modules directory which will be resolved from a given dir .