summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index 8673804ab..82051da6c 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -280,7 +280,22 @@ impl CliMainWorker {
/// Execute the given main module emitting load and unload events before and after execution
/// respectively.
pub async fn execute(&mut self) -> Result<(), AnyError> {
- self.inner.execute_main_module_possibly_with_npm().await?;
+ if self.inner.is_main_cjs {
+ deno_node::load_cjs_module(
+ &mut self.inner.worker.js_runtime,
+ &self
+ .inner
+ .main_module
+ .to_file_path()
+ .unwrap()
+ .to_string_lossy(),
+ true,
+ self.inner.shared.options.inspect_brk,
+ )?;
+ } else {
+ self.inner.execute_main_module_possibly_with_npm().await?;
+ }
+
self.inner.worker.dispatch_load_event()?;
self.pending_unload = true;