Skip to content

Commit

Permalink
force entrypoint file name for node.js execution to be .js (vercel#3451)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra authored Jan 24, 2023
1 parent 0cc0140 commit 9afc919
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/turbopack-node/src/evaluate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, thread::available_parallelism};
use std::{borrow::Cow, collections::HashMap, thread::available_parallelism};

use anyhow::Result;
use turbo_tasks::{
Expand Down Expand Up @@ -69,7 +69,13 @@ pub async fn get_evaluate_pool(
.as_asset();

let module_path = module_asset.path().await?;
let path = intermediate_output_path.join(module_path.file_name());
let file_name = module_path.file_name();
let file_name = if file_name.ends_with(".js") {
Cow::Borrowed(file_name)
} else {
Cow::Owned(format!("{file_name}.js"))
};
let path = intermediate_output_path.join(file_name.as_ref());
let entry_module = EcmascriptModuleAssetVc::new_with_inner_assets(
VirtualAssetVc::new(
runtime_asset.path().join("evaluate.js"),
Expand Down

0 comments on commit 9afc919

Please sign in to comment.