[英]How to consume third party .flow files?
I'm working on adding flow to a React.js app. 我正在努力将流添加到React.js应用程序。 I've used flow-typed to add several packages, which seems to be working. 我使用flow-typed来添加几个包,这似乎是有效的。
This issue is that I'm using the Material-UI beta . 这个问题是我使用的是Material-UI测试版 。 They don't have a repo in flow-typed, but they do provide Component.js.flow
files. 它们没有flow-typed的repo,但它们确实提供了Component.js.flow
文件。
However, I'm getting this error: 但是,我收到此错误:
Error: src/NotFound/NotFound.js:6
6: import Button from 'material-ui/Button'
^^^^^^^^^^^^^^^^^^^^ material-ui/Button. Required module not found
Error: src/NotFound/NotFound.js:8
8: import { withStyles } from 'material-ui/styles'
^^^^^^^^^^^^^^^^^^^^ material-ui/styles. Required module not found
My .flowconfig
: 我的.flowconfig
:
[ignore]
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/scripts/.*
<PROJECT_ROOT>/coverage/.*
<PROJECT_ROOT>/config/.*
.*\.test\.js
[include]
[libs]
<PROJECT_ROOT>/flow-typed/.*
[lints]
[options]
emoji=true
I've tried several solutions in support forums, but I'm still not understanding how to wire this up. 我在支持论坛中尝试了几种解决方案,但我仍然不了解如何连接它。
Important package versions: 重要包装版本:
react@15.5.4
material-ui@1.0.0-beta.8
flow-bin@0.54.0
Flow doesn't think material-ui
exists because you're explicitly ignoring all files within node_modules
in your .flowconfig
. 流程并不认为material-ui
存在,因为你明确地忽略中的所有文件node_modules
在.flowconfig
。 Remove the first line under [ignore]
( <PROJECT_ROOT>/node_modules/.*
) and you should be good to go. 删除[ignore]
下的第一行( <PROJECT_ROOT>/node_modules/.*
),你应该好好去。
Note that some other libraries may cause flow issues. 请注意,其他一些库可能会导致流量问题。 You should just ignore those selectively, rather than blanket ignore all 3rd party libs. 您应该有选择地忽略这些,而不是全部忽略所有第三方库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.