From f091d1ad69b4e5217ae3272b641171781a372c4f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 13 Nov 2024 10:10:09 -0500 Subject: feat(node): stabilize detecting if CJS via `"type": "commonjs"` in a package.json (#26439) This will respect `"type": "commonjs"` in a package.json to determine if `.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to be ESM it will be loaded as ESM though. --- cli/worker.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cli/worker.rs') diff --git a/cli/worker.rs b/cli/worker.rs index 402644a42..83e36b36c 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -44,6 +44,7 @@ use deno_runtime::WorkerExecutionMode; use deno_runtime::WorkerLogLevel; use deno_semver::npm::NpmPackageReqReference; use deno_terminal::colors; +use node_resolver::NodeModuleKind; use node_resolver::NodeResolutionMode; use tokio::select; @@ -680,6 +681,7 @@ impl CliMainWorkerFactory { package_folder, sub_path, /* referrer */ None, + NodeModuleKind::Esm, NodeResolutionMode::Execution, )?; if specifier -- cgit v1.2.3