我在项目中遇到模块解析问题,我在此仓库中重现了错误:https://github.com/melloc01/flowconfig-module_mapper,但它很简单,因此我将尝试解释:
目录结构如下:
> common/
.flowconfig
/core/
service.js
/modules/
widget.js
> project_1
.flowconfig
app.js
具有以下流程配置:
常见:
[options]
module.name_mapper='^core\/\(.*\)$' -> '<PROJECT_ROOT>/core/\1'
project_1 :
[options]
module.name_mapper='^core\/\(.*\)$' -> '<PROJECT_ROOT>/../common/core/\1'
common / modules / widget.js和project_1 / app.js都具有相同的源代码:
// @flow
import service from "core/service";
但是Flow在project_1上抛出错误,我遗漏了什么吗?