diff options
Diffstat (limited to 'ext/node/ops/require.rs')
-rw-r--r-- | ext/node/ops/require.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ext/node/ops/require.rs b/ext/node/ops/require.rs index 9e13681ae..eb092ab86 100644 --- a/ext/node/ops/require.rs +++ b/ext/node/ops/require.rs @@ -128,16 +128,11 @@ where let mut current_path = from.as_path(); let mut maybe_parent = Some(current_path); while let Some(parent) = maybe_parent { - if !parent.ends_with("/node_modules") { + if !parent.ends_with("node_modules") { paths.push(parent.join("node_modules").to_string_lossy().to_string()); - current_path = parent; - maybe_parent = current_path.parent(); } - } - - if !cfg!(windows) { - // Append /node_modules to handle root paths. - paths.push("/node_modules".to_string()); + current_path = parent; + maybe_parent = current_path.parent(); } Ok(paths) |