Skip to content

Commit

Permalink
fix: getClosestPackage method on DependencyGraph
Browse files Browse the repository at this point in the history
We cannot assume that `filePath` is _not_ a directory.
  • Loading branch information
aleclarson committed Dec 26, 2018
1 parent 761b73e commit 330ac90
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/metro/src/node-haste/DependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ class DependencyGraph extends EventEmitter {
}

_getClosestPackage(filePath: string): ?string {
const parsedPath = path.parse(filePath);
const root = parsedPath.root;
let dir = parsedPath.dir;
const {root} = path.parse(filePath);
// The `filePath` may be a directory.
let dir = filePath;
do {
const candidate = path.join(dir, 'package.json');
if (this._hasteFS.exists(candidate)) {
Expand Down

0 comments on commit 330ac90

Please sign in to comment.