Skip to content

Commit

Permalink
fix: a quick fix for webpack magic comment matching
Browse files Browse the repository at this point in the history
  • Loading branch information
xc2 committed Apr 29, 2024
1 parent af80a3f commit 2dd1dda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/rspack_plugin_javascript/src/webpack_comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn add_magic_comment_warning(
// _5 for true/false
// TODO: regexp/array
static WEBPACK_MAGIC_COMMENT_REGEXP: Lazy<regex::Regex> = Lazy::new(|| {
regex::Regex::new(r#"(?P<_0>webpack[a-zA-Z\d_-]+)\s*:\s*("(?P<_1>(\./)?([\w0-9_\-\[\]\(\)]+/)*?[\w0-9_\-\[\]\(\)]+)"|'(?P<_2>(\./)?([\w0-9_\-\[\]\(\)]+/)*?[\w0-9_\-\[\]\(\)]+)'|`(?P<_3>(\./)?([\w0-9_\-\[\]\(\)]+/)*?[\w0-9_\-\[\]\(\)]+)`|(?P<_4>[\d.-]+)|(?P<_5>true|false))"#)
regex::Regex::new(r#"(?P<_0>webpack[a-zA-Z\d_-]+)\s*:\s*("(?P<_1>[^"]+)"|'(?P<_2>[^']+)'|`(?P<_3>[^`]+)`|(?P<_4>[\d.-]+)|(?P<_5>true|false))"#)
.expect("invalid regex")
});

Expand Down

0 comments on commit 2dd1dda

Please sign in to comment.