Commit e9127b52 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

always check for duplicate modules

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