diff --git a/CHANGELOG.md b/CHANGELOG.md index 282d72bd1f7..b2706d38654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ Previously esbuild's CLI could crash if it was invoked with flags that aren't valid for a "build" API call and the `--analyze` flag is present. This was caused by esbuild's internals attempting to add a Go plugin (which is how `--analyze` is implemented) to a null build object. The panic has been fixed in this release. +* Fix incorrect location of certain error messages ([#3845](https://github.com/evanw/esbuild/issues/3845)) + + This release fixes a regression that caused certain errors relating to variable declarations to be reported at an incorrect location. The regression was introduced in version 0.18.7 of esbuild. + ## 0.23.0 **_This release deliberately contains backwards-incompatible changes._** To avoid automatically picking up releases like this, you should either be pinning the exact version of `esbuild` in your `package.json` file (recommended) or be using a version range syntax that only accepts patch upgrades such as `^0.22.0` or `~0.22.0`. See npm's documentation about [semver](https://docs.npmjs.com/cli/v6/using-npm/semver/) for more information. diff --git a/internal/js_parser/js_parser.go b/internal/js_parser/js_parser.go index 4b82e84dcd1..8f598a8c05f 100644 --- a/internal/js_parser/js_parser.go +++ b/internal/js_parser/js_parser.go @@ -1605,7 +1605,7 @@ func (p *parser) hoistSymbols(scope *js_ast.Scope) { func (p *parser) declareBinding(kind ast.SymbolKind, binding js_ast.Binding, opts parseStmtOpts) { js_ast.ForEachIdentifierBinding(binding, func(loc logger.Loc, b *js_ast.BIdentifier) { if !opts.isTypeScriptDeclare || (opts.isNamespaceScope && opts.isExport) { - b.Ref = p.declareSymbol(kind, binding.Loc, p.loadNameFromRef(b.Ref)) + b.Ref = p.declareSymbol(kind, loc, p.loadNameFromRef(b.Ref)) } }) }