React Native 是否执行 Tree Shaking? [英] Does React Native perform Tree Shaking?

查看:96
本文介绍了React Native 是否执行 Tree Shaking?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在权衡将 moment 转换为 date-fns 的好处.

I am trying to weigh up the benefits of converting moment to date-fns.

Moment 当前是 316k67.6k 压缩包.

Moment is currently 316k or 67.6k gzipped.

date-fns/format3k.

我们通过 CodePush 提供更新,因此最小化 JavaScript 包是我们绝对需要考虑的事情.

We deliver updates through CodePush so minimising the JavaScript bundle is something that we need to definitely think about doing.

React-Native 是否执行 Tree Shaking?

Does React-Native perform Tree Shaking?

推荐答案

react-native 或更具体地说,默认情况下 react-native 附带的 Metro-bundler 还不支持 tree-shaking!

react-native or more specifically, the metro-bundler that comes with react-native by default doesn't yet support tree-shaking!

根据以下链接中的评论,它应该在今年上半年(2019!)实施.

According to comments in the following link, it's supposed to be implemented in the first half of this year (2019!).

来源:https://github.com/facebook/metro/issues/227

这篇关于React Native 是否执行 Tree Shaking?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆