【发布时间】:2017-11-30 19:37:52
【问题描述】:
我遇到了 Intellij 无法找到我的 tsconfig.json 文件的问题。我的文件夹结构是这样的:
/ui
/src (all typescript files in here)
tsconfig.json
在我的tsconfig.json 文件中,我有:
{
"compilerOptions": {
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": ["es7", "dom"],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": false,
"suppressImplicitAnyIndexErrors": true,
"experimentalDecorators": true,
"types": [
"node",
"webpack-env"
]
},
"exclude": [
"node_modules",
"build",
"scripts",
"acceptance-tests",
"webpack",
"jest"
],
"include": [
"src/**/*"
]
}
Intellij 知道如何使用 command + B(转到声明)从“src”导航到我的 src 文件夹。如果我关闭 Intellij 并重新打开它并在 Typescript 中单击“全部编译”,它甚至会将所有内容编译为 Javascript。然后它报告错误Error: Cannot find parent 'tsconfig.json'。有时它仍然会编译为 Typescript,但当我单击“全部编译”时,它永远不会编译。
这是 Intellij 错误吗?好像是一个。我刚刚升级到 Intellij 2017.3,虽然我不确定我之前是否遇到过这个问题。
Typescript 版本是 2.6.2,但我在使用 2.5.3 时遇到了同样的问题。
【问题讨论】:
标签: typescript intellij-idea tsconfig