Unverified Commit c00f7325 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: sync NFT context configs (#82781)

Keep Turbopack's NFT resolve options in sync with the NFT unit tests so that we are actually asserting the production behvior.
parent 0fdaf937
......@@ -670,12 +670,13 @@ async fn externals_tracing_module_context(
compile_time_info: Vc<CompileTimeInfo>,
) -> Result<Vc<ModuleAssetContext>> {
let resolve_options = ResolveOptionsContext {
enable_node_native_modules: true,
emulate_environment: Some(compile_time_info.await?.environment),
loose_errors: true,
custom_conditions: match ty {
ExternalType::CommonJs => vec![rcstr!("require")],
ExternalType::EcmaScriptModule => vec![rcstr!("import")],
ExternalType::Url | ExternalType::Global | ExternalType::Script => vec![],
ExternalType::CommonJs => vec![rcstr!("require"), rcstr!("node")],
ExternalType::EcmaScriptModule => vec![rcstr!("import"), rcstr!("node")],
ExternalType::Url | ExternalType::Global | ExternalType::Script => vec![rcstr!("node")],
},
..Default::default()
};
......@@ -688,11 +689,14 @@ async fn externals_tracing_module_context(
// are actually representative of what Turbopack does.
ModuleOptionsContext {
ecmascript: EcmascriptOptionsContext {
// enable_types should not be enabled here. It gets set automatically when a TS file
// is encountered.
source_maps: SourceMapsType::None,
..Default::default()
},
css: CssOptionsContext {
source_maps: SourceMapsType::None,
enable_raw_css: true,
..Default::default()
},
// Environment is not passed in order to avoid downleveling JS / CSS for
......
......@@ -338,9 +338,10 @@ async fn node_file_trace_operation(
));
let module_asset_context = ModuleAssetContext::new(
Default::default(),
// TODO It's easy to make a mistake here as this should match the config in the
// binary. TODO These test cases should move into the
// `node-file-trace` crate and use the same config.
// TODO These test cases should move into the `node-file-trace` crate and use the same
// config.
// It's easy to make a mistake here as this should match the config in the binary from
// turbopack/crates/turbopack/src/lib.rs
CompileTimeInfo::new(environment),
ModuleOptionsContext {
ecmascript: EcmascriptOptionsContext {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment