首页 > 解决方案 > 流程如何与本机反应和选项'all = true'一起使用?

问题描述

我想使用选项'all = true'。但我不想解析 node_modules 文件夹。

但我收到一个错误:无法解析模块 react-native。

我的配置:

[ignore]
.*/node_modules/*

[include]

[libs]

[lints]

[options]
all=true

[strict]

[untyped]
.*/node_modules/react-native 

另一个配置(也不起作用):

[ignore]
.*/node_modules/*

[include]

[libs]

[lints]

[options]
module.system.node.resolve_dirname=node_modules
all=true

[strict]

[untyped]
.*/node_modules/react-native

有任何想法吗?

标签: react-nativeflowtype

解决方案


这与导致模块解析器忽略匹配文件的 [ignore] 配置部分不同,这本质上使它们未经类型检查,并且也无法通过 import 或 require 解析。

https://flow.org/en/docs/config/untyped/

通过放入流配置.*/node_modules/*[ignore]部分,您可以阻止 Flow 解析模块。您可以通过从该部分中删除node_modules目录(或者如果您想继续忽略其他节点模块,则仅删除包)或通过为. 我建议不要忽略所有节点模块,因为这会导致每个模块导入的 Flow 出现问题。[ignore]react-native[libs]react-native


推荐阅读