Skip to content

Commit e5449fe

Browse files
Update packages/react-native-node-api-modules/src/node/path-utils.ts
Co-authored-by: Kræn Hansen <mail@kraenhansen.dk>
1 parent 97f8c85 commit e5449fe

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/react-native-node-api-modules/src/node/path-utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,8 @@ export function determineModuleContext(
107107
// Resolve real path of package directory for caching
108108
let pkgDir = currentPath;
109109
try { pkgDir = fs.realpathSync(currentPath); } catch {}
110-
let pkgName: string;
111-
if (packageNameCache.has(pkgDir)) {
112-
pkgName = packageNameCache.get(pkgDir)!;
113-
} else {
110+
let pkgName = packageNameCache.get(pkgDir);
111+
if (!pkgName) {
114112
const content = fs.readFileSync(pkgJsonPath, "utf8");
115113
const json = JSON.parse(content) as { name: string };
116114
assert(typeof json.name === "string", "Expected package.json to have a name");

0 commit comments

Comments
 (0)