What the difference of module.system=haste and module.system=node in Facebook's flow

前端 未结 1 700
小蘑菇
小蘑菇 2021-01-11 23:47

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 modul

相关标签:
1条回答
  • 2021-01-12 00:40

    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

    The node module system is the method used by node internally.

    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.

    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.

    0 讨论(0)
提交回复
热议问题