Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The mangle reserved option does not stop labels from being renamed #1465

Open
dasa opened this issue Oct 19, 2023 · 1 comment
Open

The mangle reserved option does not stop labels from being renamed #1465

dasa opened this issue Oct 19, 2023 · 1 comment
Labels
good first issue This issue is good for contributors who are getting started

Comments

@dasa
Copy link

dasa commented Oct 19, 2023

Bug report

I'd like the output code to support this use case: https://esbuild.github.io/api/#drop-labels

I'd also like to not set compress to false, but I didn't find another way to keep Terser from removing the label. Related Issue: #1266

Version (complete output of terser -V or specific git commit)

REPL, but I think it's 5.22.0

Complete CLI command or minify() options used

REPL config:

{
  module: true,
  compress: false,
  mangle: { reserved: ["DEV", "example"] },
  output: {},
  parse: {},
  rename: {},
}

terser input

function example() {
  DEV: doAnExpensiveCheck()
  return normalCodePath()
}

terser output

function example(){n:doAnExpensiveCheck();return normalCodePath()}

Expected result

function example(){DEV:doAnExpensiveCheck();return normalCodePath()}
@dasa dasa changed the title The mangle reserved option does not stop labeled statements from being renamed The mangle reserved option does not stop labels from being renamed Oct 19, 2023
@fabiosantoscode fabiosantoscode added the good first issue This issue is good for contributors who are getting started label Oct 20, 2023
@fabiosantoscode
Copy link
Collaborator

This seems entirely reasonable. I don't have the time to work on all issues these days (there are so many!) but I'll gladly accept a PR for this.

The logic that needs to be updated is right here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue is good for contributors who are getting started
Projects
None yet
Development

No branches or pull requests

2 participants