gpt4 book ai didi

javascript - reactjs 源代码中明显的 ifs 有什么意义?

转载 作者:搜寻专家 更新时间:2023-11-01 05:00:31 25 4
gpt4 key购买 nike

我发现源码里满是对比if ("production"!== "development")

例如(来自 https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js ,第 6240 行):

if ("production" !== "development") {
this._checkPropTypes(
contextTypes,
maskedContext,
ReactPropTypeLocations.context
);
}

但是为什么?此类检查的结果始终相同。

最佳答案

他们使用 browserifyenvify .

envify will replace your environment variable checks with ordinary strings - only the variables you use will be included, so you don't have to worry about, say, AWS_SECRET_KEY leaking through either. [...] By running this through a good minifier (e.g. UglifyJS2), the above code would be stripped out completely.

关于javascript - reactjs 源代码中明显的 ifs 有什么意义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28936343/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com