diff --git a/internal/js_parser/js_parser.go b/internal/js_parser/js_parser.go index c69f14041c4..1e9e804c412 100644 --- a/internal/js_parser/js_parser.go +++ b/internal/js_parser/js_parser.go @@ -12293,7 +12293,11 @@ func (p *parser) visitExprInOut(expr js_ast.Expr, in exprIn) (js_ast.Expr, exprO p.markSyntaxFeature(compat.ImportMeta, r) } else if p.options.mode != config.ModePassThrough && !p.options.outputFormat.KeepES6ImportExportSyntax() { r := logger.Range{Loc: expr.Loc, Len: e.RangeLen} - p.log.AddIDWithNotes(logger.MsgID_JS_EmptyImportMeta, logger.Warning, &p.tracker, r, fmt.Sprintf( + kind := logger.Warning + if p.suppressWarningsAboutWeirdCode || p.fnOrArrowDataVisit.tryBodyCount > 0 { + kind = logger.Debug + } + p.log.AddIDWithNotes(logger.MsgID_JS_EmptyImportMeta, kind, &p.tracker, r, fmt.Sprintf( "\"import.meta\" is not available with the %q output format and will be empty", p.options.outputFormat.String()), []logger.MsgData{{Text: "You need to set the output format to \"esm\" for \"import.meta\" to work correctly."}}) } diff --git a/internal/js_parser/js_parser_lower.go b/internal/js_parser/js_parser_lower.go index 63d2c75cb3c..7ea11a57c9c 100644 --- a/internal/js_parser/js_parser_lower.go +++ b/internal/js_parser/js_parser_lower.go @@ -131,7 +131,11 @@ func (p *parser) markSyntaxFeature(feature compat.JSFeature, r logger.Range) (di case compat.ImportMeta: // This can't be polyfilled - p.log.AddIDWithNotes(logger.MsgID_JS_EmptyImportMeta, logger.Warning, &p.tracker, r, fmt.Sprintf( + kind := logger.Warning + if p.suppressWarningsAboutWeirdCode || p.fnOrArrowDataVisit.tryBodyCount > 0 { + kind = logger.Debug + } + p.log.AddIDWithNotes(logger.MsgID_JS_EmptyImportMeta, kind, &p.tracker, r, fmt.Sprintf( "\"import.meta\" is not available in %s and will be empty", where), notes) return