I am developing a next.js app. It has the following tsconfig.js
{
\"compilerOptions\": {
\"target\": \"ES2018\",
\"module\": \"esnext\",
From TypeScript issue #33809:
It really doesn't make sense to have
incremental
andnoEmit
together, sincenoEmit
prevents us from writing incremental metadata. (So nothing is actually incremental).You should consider
emitDeclarationOnly
instead ofnoEmit
, if you actually just want incremental checking.
According to this, the incremental: true
flag has done nothing to speed up the build while noEmit: true
is defined. So you should either remove noEmit: true
or change it to emitDeclarationOnly: true
.
You can control the output folders using outDir
and declarationDir
.
--incremental
with --noEmit
is possible now:
"compilerOptions": {
"noEmit": true,
"incremental": true,
// "tsBuildInfoFile": "/tmp/my-proj/tsbuildinfo" // custom build info file path
// ...
}
The build info file is emitted even with noEmit
. You can set its explicit location via --tsBuildInfoFile. Otherwise outDir
- if still set - or tsconfig.json
project root is taken as emit directory.
"compilerOptions": {
"incremental": true,
"declaration": true,
"emitDeclarationOnly": true, // to emit at least something
// "noEmit": true,
// ...
// Either set overall output directory
"outDir": "dist",
// or separate locations for build file and declarations
// "declarationDir": "dist"
// "tsBuildInfoFile": "/tmp/my-proj/tsbuildinfo"
}