esmangle icon indicating copy to clipboard operation
esmangle copied to clipboard

Prevent function constructors from being mangled

Open yanickrochon opened this issue 10 years ago • 2 comments

When optimizing some code sent to the browser with browserify, I expose a constructor function as Message, but when I evaluate the generated code, I see that Message: function b(d), so I lose the constructor name, so I cannot see the correct object types once instanciated.

Is there a way to keep constructor function unmangled?

yanickrochon avatar Oct 16 '15 16:10 yanickrochon

I thoight this was a duplicate, but apparently it's not... You should add a property yourself to keep track of the name, I think.

vendethiel avatar Oct 16 '15 17:10 vendethiel

Well, could there be some way to pass an option to specify reserved function names that should not be mangled?

yanickrochon avatar Oct 16 '15 18:10 yanickrochon