We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 306066d commit 6de58e1Copy full SHA for 6de58e1
napi/src/options.rs
@@ -217,7 +217,8 @@ impl From<Restriction> for rspack_resolver::Restriction {
217
panic!("Should specify path or regex")
218
}
219
(None, Some(regex)) => {
220
- let re = Regex::new(®ex).expect(&format!("Invalid regex pattern: {}", regex));
+ let re =
221
+ Regex::new(®ex).unwrap_or_else(|_| panic!("Invalid regex pattern: {regex}"));
222
Self::Fn(Arc::new(move |path| re.is_match(path.to_str().unwrap_or_default())))
223
224
(Some(path), None) => Self::Path(PathBuf::from(path)),
0 commit comments