如何使用 Flowtype 设置 React+Flux
How to setup React+Flux with Flowtype
我发现很难设置使用 React+Flux 和 Flowtype 的项目。
这是我的 .flowconfig
拥有的:
[ignore]
.*/node_modules/.*
static/.*
[options]
module.name_mapper='^core/\(.*\)' -> '<PROJECT_ROOT>/core/'
这是一些文件
/* @flow */
import Dispatcher from 'flux';
import Action from 'core/Action';
const AppDispatcher: Dispatcher<Action> = new Dispatcher();
export default AppDispatcher;
但是当我尝试 运行 flow check
我收到:
core/Dispatcher.js:2
2: import Dispatcher from 'flux';
^^^^^^ flux. Required module not found
谁能分享一下他们搭建项目的成功经验?
谢谢。
发生这种情况是因为您选择忽略 node_modules
,因此流看不到 flux
。您需要从配置中删除此行或为 flux
添加声明
我发现很难设置使用 React+Flux 和 Flowtype 的项目。
这是我的 .flowconfig
拥有的:
[ignore]
.*/node_modules/.*
static/.*
[options]
module.name_mapper='^core/\(.*\)' -> '<PROJECT_ROOT>/core/'
这是一些文件
/* @flow */
import Dispatcher from 'flux';
import Action from 'core/Action';
const AppDispatcher: Dispatcher<Action> = new Dispatcher();
export default AppDispatcher;
但是当我尝试 运行 flow check
我收到:
core/Dispatcher.js:2
2: import Dispatcher from 'flux';
^^^^^^ flux. Required module not found
谁能分享一下他们搭建项目的成功经验?
谢谢。
发生这种情况是因为您选择忽略 node_modules
,因此流看不到 flux
。您需要从配置中删除此行或为 flux