使用 react "runtime": "automatic" with flow
Use react "runtime": "automatic" with flow
{
"presets": [
"@babel/preset-env",
["@babel/preset-react", {
"runtime": "automatic"
}],
"@babel/preset-flow"
]
}
上面你可以看到我的 .bablerc
文件,我尝试设置机会创建组件而不在其顶部包含 React
导入。但是flow
对此有自己的看法,return警告Cannot resolve name React. [cannot-resolve-name]
。这样怎么办?)
您必须添加到您的 .flowconfig
选项
react.runtime=automatic
已记录 here
{
"presets": [
"@babel/preset-env",
["@babel/preset-react", {
"runtime": "automatic"
}],
"@babel/preset-flow"
]
}
上面你可以看到我的 .bablerc
文件,我尝试设置机会创建组件而不在其顶部包含 React
导入。但是flow
对此有自己的看法,return警告Cannot resolve name React. [cannot-resolve-name]
。这样怎么办?)
您必须添加到您的 .flowconfig
选项
react.runtime=automatic
已记录 here