I have a monorepo where I am converting a subproject to TypeScript. In my npm scripts I have:
"build-proj1":"tsc --build ./proj1/tsconfig.json"
It works, but for some reason, I noticed that it is extremely slow.
When I change it to:
"build-proj1":"tsc --project ./proj1/tsconfig.json"
It executes much faster and produces same result...
My tsconfig.json
for reference:
{
"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.*"]
}
My question is what is the difference between --build
and --project
, and why --build
would run much slower than --project
?