From 3eaf174bfc64b7c277899abd44ae3877538028df Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 5 Mar 2024 19:23:51 -0500 Subject: fix(node): improve cjs tracking (#22673) We were missing saying that a file is CJS when some Deno code imported from the node_modules directory at runtime. --- cli/cache/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli/cache') diff --git a/cli/cache/mod.rs b/cli/cache/mod.rs index 7d95a6423..229a9cb54 100644 --- a/cli/cache/mod.rs +++ b/cli/cache/mod.rs @@ -196,7 +196,9 @@ impl Loader for FetchCacher { ) -> LoadFuture { use deno_graph::source::CacheSetting as LoaderCacheSetting; - if specifier.path().contains("/node_modules/") { + if specifier.scheme() == "file" + && specifier.path().contains("/node_modules/") + { // The specifier might be in a completely different symlinked tree than // what the node_modules url is in (ex. `/my-project-1/node_modules` // symlinked to `/my-project-2/node_modules`), so first we checked if the path -- cgit v1.2.3