问题描述
我正在使用Facebook流程的项目中工作.在流程的高级配置"中,[options]标题有两个选择(module.system = haste和module.system = node).
I work on a project which is using Facebook's flow. In the Advanced Configuration of flow and there are two choices for the [options] heading (module.system=haste and module.system=node).
现在我想知道急速"和节点"的区别是什么.
Now I would like to know what is the difference of "haste" and "node".
推荐答案
它们是两种解决模块的方法:haste
是react-native用于打包的模块系统(类似于browserify或用于浏览器的webpack):
They are 2 different ways of resolving modules: haste
is the module system used by react-native for packaging (similar to browserify or webpack for browsers):
https://github.com/facebook/node-haste
node
模块系统是节点内部使用的方法.
The node
module system is the method used by node internally.
关于它们实际的差异 :遗憾的是haste
尚无详尽的文档. AFAICT的主要区别在于haste
可以将包引用(例如require('underscore')
)解析为单个模块,而node
实际上将为每个子包使用不同的模块.基本上:使用node
,您可以在单个程序中获得多个版本,例如underscore
,而对于haste
,仅将一个版本的underscore
放入最终程序包中.
As for how they actually differ: unfortunately haste
does not have extensive documentation yet. AFAICT the primary difference is that haste
can resolve packages references (e.g. require('underscore')
) to a single module, whereas node
will actually use a different module for each sub-package. Basically: with node
you can end up with multiple versions of say, underscore
in a single program, whereas with haste
only one version of underscore
is put into the final package.
如果项目中有多个模块版本,则可能导致细微差异,尽管显然haste
是变得与现有节点行为更加兼容.
This can result in subtle differences if there are multiple versions of a module in a project, though apparently haste
is becoming more compatible with existing node behavior.
这篇关于Facebook的流程中module.system = haste和module.system = node的区别是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!