【发布时间】:2018-10-30 03:34:03
【问题描述】:
我已经四处寻找解决此问题的方法。他们都建议将"jsx": "react" 添加到您的 tsconfig.json 文件中。我已经做到了。另一种是添加"include: []",我也这样做了。但是,当我尝试编辑.tsxfiles 时,我仍然收到错误消息。下面是我的 tsconfig 文件。
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"allowJs": true,
"checkJs": false,
"jsx": "react",
"outDir": "./build",
"rootDir": "./lib",
"removeComments": true,
"noEmit": true,
"pretty": true,
"skipLibCheck": true,
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true
},
"include": [
"./lib/**/*"
],
"exclude": [
"node_modules"
]
}
任何建议都会有所帮助。我正在使用 babel 7 编译所有带有 env、react 和 typescript 预设的代码。如果你们需要更多文件来帮助调试,请告诉我。
【问题讨论】:
-
目前还不清楚是什么问题。 babel 7 用 env、react 和 typescript 预设编译所有代码 - 为什么同时存在 Babel 和 TS 以及它们之间的关系? 我仍然收到错误 - 哪一个? “jsx”:“反应” - Note: The identifier React is hard-coded, so you must make React available with an uppercase R
标签: reactjs typescript jsx tsx