我有一个monorepo,我正在将一个子项目转换为TypeScript。 在我的npm脚本中,我有:
"build-proj1":"tsc --build ./proj1/tsconfig.json"
它可以工作,但是我注意到它特别慢。
当我改为:
"build-proj1":"tsc --project ./proj1/tsconfig.json"
它执行速度更快,产生相同的结果...
我的tsconfig.json
供参考:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "CommonJS",
"target": "es2018",
"lib": ["es2019"],
"noImplicitAny": false,
"declaration": false,
"allowJs": true,
"preserveConstEnums": true,
"outDir": "./dist",
"sourceMap": true,
"skipLibCheck": true,
"baseUrl": "./",
"types": ["node"],
"typeRoots": ["../node_modules/@types"],
"strict": true,
"esModuleInterop": true,
"disableReferencedProjectLoad": true,
"paths": {
"root-common/*": ["../common/*"],
"root-config/*": ["../config/*"],
"root/*": ["../*"]
}
},
"include": ["./**/*"],
"exclude": ["node_modules", "**/*.spec.ts", "**/*.test.*", "./dist/**/*", "../common/**/*test.*"]
}
我的问题是--build
和--project
之间有什么区别,为什么--build
比--project
慢得多?