From 640d0559c01e7f402f99a0ba15f4d075e7686b7f Mon Sep 17 00:00:00 2001 From: nanianlisao <597219320@qq.com> Date: Thu, 12 Dec 2024 14:17:00 +0800 Subject: [PATCH] chore: support ERROR_LOG to not eprintln error --- crates/module_graph/src/graph.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/module_graph/src/graph.rs b/crates/module_graph/src/graph.rs index 8a1a643..914ccbb 100644 --- a/crates/module_graph/src/graph.rs +++ b/crates/module_graph/src/graph.rs @@ -1,5 +1,6 @@ use std::{ collections::{HashMap, HashSet}, + env, path::Path, sync::{ atomic::{AtomicU32, Ordering}, @@ -181,11 +182,15 @@ impl<'a> Graph<'a> { { Ok(rp) => rp, Err(_) => { - eprintln!( - "resolve error: {} {}", - source_value, - path.to_string_lossy() - ); + let error_log = + env::var("ERROR_LOG").unwrap_or_else(|_| "1".to_string()); + if error_log == "1" { + eprintln!( + "resolve error: {} {}", + source_value, + path.to_string_lossy() + ); + } continue; } };