Skip to content

Commit 63f3d9f

Browse files
chore: fix module.parent deprecated (#22)
1 parent ef8bf73 commit 63f3d9f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/spotty-squids-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@relay-graphql-js/generate-config": patch
3+
---
4+
5+
chore: fix `module.parent` deprecated according to #21

packages/generate-config/src/dependencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function moduleFromDependencyModules(moduleFilter: ModuleFilter) {
2525
let mod = module;
2626
if (typeof jest === "undefined") {
2727
while (filterModules(mod, moduleFilter)) {
28-
mod = mod.parent!;
28+
mod = Object.values(require.cache).filter((m) => m.children.includes(module))[0] ?? null;
2929
}
3030
if (mod === null) {
3131
throw new Error(`Unable to find ${moduleFilter}'s node_modules`);

0 commit comments

Comments
 (0)