summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-09-19 21:10:34 -0700
committerGitHub <noreply@github.com>2024-09-19 21:10:34 -0700
commita01dce3a25e0bf671c6c21bd6ff57861be613087 (patch)
treebecb8a7c90e5a21e83c81160eec9d91e1281bc92 /cli/worker.rs
parentf1ba26661346a83b6e7fe5e7ffeed4553a9571ae (diff)
fix: cjs resolution cases (#25739)
Fixes cjs modules being loaded as esm.
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index 78753bf22..6176398d5 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -526,7 +526,8 @@ impl CliMainWorkerFactory {
let is_main_cjs = matches!(node_resolution, NodeResolution::CommonJs(_));
(node_resolution.into_url(), is_main_cjs)
} else {
- (main_module, false)
+ let is_cjs = main_module.path().ends_with(".cjs");
+ (main_module, is_cjs)
};
let ModuleLoaderAndSourceMapGetter { module_loader } =