gpt4 book ai didi

angularjs - Intellij 不断编译 TypeScript(非常慢)——如何阻止这种行为?

转载 作者:搜寻专家 更新时间:2023-10-30 21:12:37 25 4
gpt4 key购买 nike

我正在将 Angular 1.x 项目从普通 JS 迁移到 TypeScript。但是,我的 IDE 的响应时间非常慢。 Constant compiling of many files

如果我在“设置”>“语言和框架”>“TypeScript”中取消选中“跟踪更改”,编译将停止——但我的 TS 无法编译!

当然,我可以配置一个 gulp 文件并设置一个观察器,在发生变化时重新编译文件。但是,如果可能的话,我想避免为每个项目运行 gulp 的需要。此外,更重要的是,取消选中“跟踪更改”会删除 TS 特定建议并且似乎会破坏某些引用。

跟踪更改:选中 - 帮助 + 引用 Help + References

跟踪更改:未选中 - 无帮助 + 引用损坏 No help + References broken

问题 #1:

是否可以将 Intellij 配置为只编译更改的文件?

问题 #2:

为什么 Intellij 编译这么多文件?这是我的 tsconfig.json 的副本:

{
"compilerOptions": {
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "build/local/tsc.js",
"sourceMap": true,
"typeRoots": [
"./node_modules/@types",
"./typings"
],
"moduleResolution": "node"
},

"exclude": [
"client/src/node_modules",
"**/*.spec.ts",
"src/bower_components",
"client/src/bower_components",
"client/src/node_modules",
"build",
"Saved_HTML",
"site-ideas",
"node_modules",
"client/typings"
]
}

请注意,尽管将 node_modules 设置为忽略的目录,编译器仍会到达那里。 enter image description here .

最佳答案

问题 1:

IntelliJ 非常频繁地保存文件。 Typescript 在保存文件时进行编译。因此,你应该 disable or limit autosave .

问题 2:

我不知道为什么排除文件对您不起作用,但我建议包含 "rootDir": "./yourSourceDir" 而不是排除其他文件。

关于angularjs - Intellij 不断编译 TypeScript(非常慢)——如何阻止这种行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40569900/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com