使用Terser缩小对数学,号码等的电话
Terser为我的项目制作的代码包含许多对JavaScript MATH
对象的调用,我想知道是否有一种简单的方法来缩小这些调用。
这是带有MATH
突出显示的刻度代码的一部分的屏幕截图(总共有几千个调用MATH
):
sstatic.net/qi4y0.png“ rel =“ nofollow noreferrer 通过设置const min = math.min
等,在我的原始代码中进行优化,但这很难维护,通常是可憎的微型优化。
正如我所看到的,在Mangle选项中无法使用属性,因为属性
明确无助于内置的JavaScript属性。
是否有人知道如何使用Terser缩小Math
,数字等的调用?
The code that Terser produces for my project contains many calls to the Javascript Math
object and I am wondering if there is an easy way to minify these calls.
Here is a screenshot of part of the minfied code with Math
highlighted (altogether there are almost a thousand calls to Math
):
I could certainly do the optimization in my original code by setting const min = Math.min
etc, but this would be hard to maintain and generally an abominal micro optimization.
As I see it properties
in the mangle options cannot be used for this, as properties
explicitly will NOT work for built-in Javascript properties.
Does anybody have an idea how calls to Math
, Number
, etc. can be minified with Terser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找不到使用Terser的解决方案。
但是我得出的结论是,由于以下原因,将所有调用到
MATH
的呼叫是没有多大意义的:因此总而言之,这似乎既不可能也不必需。
I could not find a solution for this using Terser.
BUT I came to the conclusion, that it would not make much sense to minify all calls to
Math
for the following reasons:So in conclusion this seems to be neither possible nor necessary.