Skip to content

panic: Expected scope, found scope while parsing #4088

@dloebl

Description

@dloebl

While updating to esbuild v0.25.0, we noticed that some inputs cause esbuild to panic. I've tried my best to minify the input JS, but it's still a rather large reproducer.

Input:
min_js.zip

Steps:

$ esbuild min.js

✘ [ERROR] panic: Expected scope (7, 186) in min.js, found scope (7, 165) (while parsing "min.js")

  debug.Stack (runtime/debug/stack.go:26)
  helpers.PrettyPrintedStack (internal/helpers/stack.go:9)
  bundler.parseFile.func1 (internal/bundler/bundler.go:254)
  panic (runtime/panic.go:785)
  js_parser.Parse.func1 (internal/js_parser/js_parser.go:17334)
  panic (runtime/panic.go:785)
  js_parser.(*parser).pushScopeForVisitPass (internal/js_parser/js_parser.go:8421)
  js_parser.(*parser).visitFn (internal/js_parser/js_parser.go:16735)
  js_parser.(*parser).visitExprInOut (internal/js_parser/js_parser.go:15432)
  js_parser.(*parser).visitExpr (internal/js_parser/js_parser.go:12819)
[..]

1 error

Version: 0.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions