Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a function that has a constructor within it. It creates a new object and returns it:

function car() {
   function Car() {}
   return new Car();
}

As a result uglify renames Car to some letter and when this returns it looks like the object name is just some letter. In chrome for instance it will say the type of the object is "t".

Is there a way to tell uglify to preserve some function's name?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
355 views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to use the reserved-names parameter:

--reserved-names “Car”

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...