简体   繁体   English

如何使用第三方.flow文件?

[英]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.

相关问题 如何在angular cli应用程序中使用typescript声明(.ts.d文件)来使用第三方javascript API / SDK? - How Do I use typescript declarations (.ts.d files) to consume a third party javascript API / SDK in an angular cli application? oAuth 来自第三方域的数据流 - oAuth flow of data from third party domain 如何使用JSPM使用缩小的第三方Javascript文件 - How to use minified third party Javascript files using JSPM 如何在div中打开第三方 - How to open Third Party in div 如何将第三方 cookies 传递到各自的第三方域? - How to pass third party cookies to the respective third party domains? 将本地文件传递给第三方框架 - Passing local files to third-party framework Typescript扩展了第三方声明文件 - Typescript extend third-party declaration files 如何在 ReactJS 项目中使用 webpack 预加载第三方的 css 和 js 文件? - How to preload third-party's css and js files using webpack in ReactJS project? 如何封装第三方JavaScript文件,以免污染全局范围? - How do I encapsulate third-party JavaScript files so they don't pollute the global scope? 如何在不使用第三方库的情况下使用 Node.js 读取 PDF 文件? - How to read PDF files with Node.js without using third-party library?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM