port check_if_should_use_esm_loader to rust (#12562)

This commit is contained in:
Ryan Dahl 2021-11-01 14:46:07 -04:00 committed by GitHub
parent 1b684d333d
commit b92019a847
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 32 deletions

View file

@ -1153,11 +1153,7 @@ async fn run_command(
// this file.
worker.execute_side_module(&compat::MODULE_URL).await?;
let use_esm_loader = compat::check_if_should_use_esm_loader(
&mut worker.js_runtime,
&main_module.to_file_path().unwrap().display().to_string(),
)
.await?;
let use_esm_loader = compat::check_if_should_use_esm_loader(&main_module)?;
if use_esm_loader {
// ES module execution in Node compatiblity mode