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

Feature Request: Output __publicField without string literal for property mangling compatibility #4034

Open
mckravchyk opened this issue Jan 11, 2025 · 0 comments

Comments

@mckravchyk
Copy link

mckravchyk commented Jan 11, 2025

When targeting ES2017, ESBuild will output public class fields like:

__publicField(this, "propName")

I am using Terser for post-processing with property mangling by Regex enabled. Terser is not able to recognise the string in the function argument as a property to mangle, which makes it incompatible.

The same could be achieved with:

__publicField(this, { propName: '' })

at a small cost of being more verbose and some runtime footprint to get Object.keys(arg)[0] It could be an option / not enabled by default.

Alternatively, is there a reason why Object.defineProperty is not used? This is something that Terser makes an exception for, TypeScript also outputs JS this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant