我是靠谱客的博主 甜美天空,这篇文章主要介绍React‘ refers to a UMD global 或者 Cannot use JSX unless the ‘--jsx‘ flag is provided.,现在分享给大家,希望可以做个参考。
开发 typescript+react 项目 div等标签报红:
React’ refers to a UMD global, but the current file is a module. Consider adding an import instead
修改 tsconfig.json 文件
"compilerOptions": {
"jsx": "react-jsx"
}
修改后如还是报: Cannot use JSX unless the ‘–jsx’ flag is provided.
需重启编辑器
最后
以上就是甜美天空最近收集整理的关于React‘ refers to a UMD global 或者 Cannot use JSX unless the ‘--jsx‘ flag is provided.的全部内容,更多相关React‘内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复