Skip to content

Files

Latest commit

0d1b4ea · Jun 4, 2020

History

History
15 lines (8 loc) · 637 Bytes

re-10.md

File metadata and controls

15 lines (8 loc) · 637 Bytes

如何告诉 React 它应该编译生产环境版本?

?> 英:How do you tell React to build in Production mode and what will that do?

答:

通常情况下我们会使用 WebpackDefinePlugin 方法来将 NODE_ENV 变量值设置为 production

编译版本中 React 会忽略 propType 验证以及其他的告警信息,同时还会降低代码库的大小,React 使用了 Uglify 插件来移除生产环境下不必要的注释等信息。

参考资料:

题目来源

翻译文章