From de4a115da78e518f927474512a2dcbe491985070 Mon Sep 17 00:00:00 2001 From: MohammadSu1 Date: Sun, 3 Nov 2024 09:06:49 +0200 Subject: [PATCH] fix: adding a check to .mjs, and .mts files and skip the suggestions if one of them detected --- runtime/fmt_errors.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runtime/fmt_errors.rs b/runtime/fmt_errors.rs index 7c6cf6d397..4ecea219b6 100644 --- a/runtime/fmt_errors.rs +++ b/runtime/fmt_errors.rs @@ -303,6 +303,13 @@ fn format_js_error_inner( } fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec { + if let Some(frame) = e.frames.get(0) { + if let Some(file_name) = &frame.file_name { + if file_name.ends_with(".mjs") || file_name.ends_with(".mts") { + return vec![]; + } + } +} if let Some(msg) = &e.message { if msg.contains("module is not defined") || msg.contains("exports is not defined")