Commit e9127b52 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

always check for duplicate modules

parent 7eb53237
...@@ -347,28 +347,27 @@ impl SingleModuleGraph { ...@@ -347,28 +347,27 @@ impl SingleModuleGraph {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
{ {
use once_cell::sync::Lazy; // use once_cell::sync::Lazy;
// // TODO(PACK-4578): This is temporary while the last issues are being addressed.
// TODO(PACK-4578): This is temporary while the last issues are being addressed. // static CHECK_FOR_DUPLICATE_MODULES: Lazy<bool> = Lazy::new(|| {
static CHECK_FOR_DUPLICATE_MODULES: Lazy<bool> = Lazy::new(|| { // match std::env::var_os("TURBOPACK_TEMP_DISABLE_DUPLICATE_MODULES_CHECK") {
match std::env::var_os("TURBOPACK_TEMP_DISABLE_DUPLICATE_MODULES_CHECK") { // Some(v) => v != "1" && v != "true",
Some(v) => v != "1" && v != "true", // None => true,
None => true, // }
} // });
}); // if *CHECK_FOR_DUPLICATE_MODULES {
if *CHECK_FOR_DUPLICATE_MODULES { let mut duplicates = Vec::new();
let mut duplicates = Vec::new(); let mut set = FxHashSet::default();
let mut set = FxHashSet::default(); for &module in modules.keys() {
for &module in modules.keys() { let ident = module.ident().to_string().await?;
let ident = module.ident().to_string().await?; if !set.insert(ident.clone()) {
if !set.insert(ident.clone()) { duplicates.push(ident)
duplicates.push(ident)
}
}
if !duplicates.is_empty() {
panic!("Duplicate module idents in graph: {duplicates:#?}");
} }
} }
if !duplicates.is_empty() {
panic!("Duplicate module idents in graph: {duplicates:#?}");
}
// }
} }
let graph = SingleModuleGraph { let graph = SingleModuleGraph {
......
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