Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/oxc_transformer/src/plugins/replace_global_defines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ impl ReplaceGlobalDefinesConfig {

if parts.len() == 1 {
if !is_identifier_name(parts[0]) {
return Err(vec![OxcDiagnostic::error(format!("`{key}` is not an identifier."))]);
return Err(vec![OxcDiagnostic::error(format!(
"The define key `{key}` is not an identifier."
))]);
}
return Ok(IdentifierType::Identifier);
}
Expand All @@ -148,7 +150,9 @@ impl ReplaceGlobalDefinesConfig {

for part in &parts[0..normalized_parts_len] {
if !is_identifier_name(part) {
return Err(vec![OxcDiagnostic::error(format!("`{key}` is not an identifier."))]);
return Err(vec![OxcDiagnostic::error(format!(
"The define key `{key}` contains an invalid identifier `{part}`."
))]);
}
}
if is_import_meta {
Expand All @@ -167,7 +171,7 @@ impl ReplaceGlobalDefinesConfig {
// StaticMemberExpression with postfix wildcard
} else if normalized_parts_len != parts.len() {
Err(vec![OxcDiagnostic::error(
"postfix wildcard is only allowed for `import.meta`.".to_string(),
"The postfix wildcard is only allowed for `import.meta`.".to_string(),
)])
} else {
Ok(IdentifierType::DotDefines {
Expand Down