minify icon indicating copy to clipboard operation
minify copied to clipboard

Minify private methods and private properties of JS classes

Open AnatoliyDanchuk opened this issue 2 years ago • 3 comments

Actual: Private methods and private properties of JS classes are not minified. Expected: Private methods and private properties of JS classes are minified.

Example:

class AnyClassName {
        #anyPrivateProperty = 1;
        #anyPrivateMethod() {}
}

AnatoliyDanchuk avatar Dec 18 '23 12:12 AnatoliyDanchuk

It seems to work on my part: https://go.tacodewolff.nl/minify?q=b21pbWU9dGV4dCUyRmphdmFzY3JpcHQmanMtcHJlY2lzaW9uPTAmanMtdmVyc2lvbj0wJnNyYz1jbGFzcytBbnlDbGFzc05hbWUrJTdCJTBEJTBBKysrKysrKyslMjNhbnlQcml2YXRlUHJvcGVydHkrJTNEKzElM0IlMEQlMEErKysrKysrKyUyM2FueVByaXZhdGVNZXRob2QoKSslN0IlN0QlMEQlMEElN0Q=

What version are you using?

tdewolff avatar Dec 18 '23 12:12 tdewolff

I have checked your link. And your link confirms names of private properties/methods are not minimized. I expect that names will be minimized to single char, because private properties and methods have only local scope like const|let, thus minimizer may safety minimize their names. I used versions: v2.20.10, v2.20.9.

AnatoliyDanchuk avatar Dec 18 '23 16:12 AnatoliyDanchuk

Ah now I understand, you mean that the names themselves are not minified, even though the syntax of private properties and methods are minified. I will look into this, great idea!

tdewolff avatar Dec 18 '23 20:12 tdewolff