Skip to content

invalid code generation #3756

Closed
Closed

Description

@eco747

compiling this typescript code with esbuild 0.21.0

const t = {
	get passive ( ) {
		return false;
	}
}
console.log(t);

generate this javascript

var t = {
  get passive: /* @__PURE__ */ __name(function() {
    return false;
  }, "passive")
};
console.log(t);

this is syntactically incorrect

get passive: _name(xxx)
           ^  here

with these options:

"bundle": true,
"format": "esm",
"platform": "browser",
"charset": "utf8",
"keepNames": true,
"target": "esnext"

Activity

  1. eco747 commented on May 7, 2024

    @eco747
    Author

    This probleme was not present in 0.20.x version
    This is due to keepnames=true, if I use keepNames=false, obviously the problem disapear.

  2. GentileFulvio commented on May 7, 2024

    @GentileFulvio

    Same issue here

  3. evanw commented on May 7, 2024

    @evanw
    Owner

    Thanks for the report. Working on it.

  4. added a commit that references this issue on May 7, 2024
    e7a9256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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