Skip to content

Disabling mangle via cache doesn't restore enum constant replacement #4414

@dextercd

Description

@dextercd

This TypeScript code:

enum token { begin, end, if_ } console.log(token.if_) console.log(token.begin)

with this config:

{ mangleProps: /_$/, mangleCache: { if_: false }, }

compiles down to:

// <snip> .. enum .. </snip> console.log(token.if_); console.log(0 /* begin */);

While this code is valid and works, I think it'd be better if it compiled to:

// <snip> .. enum .. </snip> console.log(2 /* if_ */); console.log(0 /* begin */);

It feels unintended that it doesn't work this way, but I could of course be missing something.

esbuild playground link

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