Pages

Topics

Tools

↑↓navigate↵openescclose
All guides

TS18003: No inputs were found in config file

TS18003 means include, exclude and extends produced an empty file set. Print the resolved config, then fix the path, the base config or the sources.

~5 min readTypeScript
#TypeScript#Compiler#Configuration#Build
A TypeScript config sheet with an empty input tray beside a cyan compiler gate and an amber include path plate

Introduction & Quick Summary

text
error TS18003: No inputs were found in config file '/repo/tsconfig.json'. Specified 'include' paths were '["src/**/*"]' and 'exclude' paths were '["node_modules"]'.

TS18003 is not a type error. It means the compiler resolved your tsconfig.json, computed the set of input files from files, include and exclude, and the set came out empty. Nothing was checked because nothing was found, so the build is red while every source file may still be perfectly valid.

The four causes worth checking first:

  • The config is being read from a different directory than you think. include is relative to the directory that holds the tsconfig.json, not to process.cwd() or to the file that triggered the compile.
  • A parent config already narrowed include. "extends": "../../tsconfig.base.json" inherits include, exclude and files unless the child overrides them, and relative paths are resolved against the inherited file's directory.
  • exclude canceled everything. Excluding dist, then including dist/**/*, leaves zero inputs. Negations in include do not restore order the way people expect.
  • The files are JavaScript or .mts/.cts and no matching extension is enabled. allowJs off means .js files are simply not inputs.
SymptomReal causeFix
include looks correct but failsConfig nested deeper than expectedPrint the resolved config, then fix relative paths
Works in root, fails in packages/*Inherited include from a base configRedeclare include in the child
Fails only in Docker or CI.dockerignore removed src/Copy sources before tsc
Fails with src deleted by a scriptclean script ran before tscOrder the pipeline correctly
Only .js files in the folderallowJs is falseEnable allowJs or point at .ts files

Core Mechanics, Signatures & Reproducible Setup

The compiler builds the program from a file list. files is an explicit array with no globbing. include is an array of glob patterns resolved against the config directory. exclude removes matches, but it only filters what include produced, and it always defaults to node_modules, bower_components, jspm_packages and the outDir when omitted. Extensions considered are .ts, .tsx, .d.ts by default, plus .js, .jsx with allowJs, plus .mts/.cts and .mjs/.cjs in modern versions.

Reproduce it in one directory:

bash
mkdir -p /tmp/ts18003/src && cd /tmp/ts18003 cat > tsconfig.json <<'JSON' { "compilerOptions": { "strict": true, "noEmit": true }, "include": ["app/**/*"] } JSON cat > src/index.ts <<'TS' export const answer: number = 42; TS npx -p typescript@5 tsc -p tsconfig.json # error TS18003: No inputs were found in config file '/tmp/ts18003/tsconfig.json'.

Print what the compiler actually resolved instead of guessing:

bash
npx tsc -p tsconfig.json --showConfig | head -40

--showConfig prints the effective configuration with every inherited value already merged, which is the fastest way to see a stray include from a base file.

Inside a monorepo the same failure appears when the package config only extends:

{ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "dist" } }

If the base file sets "include": ["src"], the child inherits the string but resolves it against the base file's directory, so it points at the repository root's src from the compiler's point of view only after merging. Always redeclare in the leaf package:

{ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "dist", "rootDir": "src" }, "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": ["dist", "node_modules"] }

A second reproducible trap is the exclude that swallows the only source folder:

{ "include": ["src/**/*"], "exclude": ["src"] }

This yields TS18003 with a config that looks self-consistent. exclude wins over include for the same path.

Key Comparison Table

FieldRelative toInherited via extendsGlob supportTypical mistake
filesConfig directoryYes, replaced wholesaleNoneListing a directory
includeConfig directoryYes, replaced wholesaleYes (**, *, ?)Assuming CWD
excludeConfig directoryYes, replaced wholesaleYesExcluding the only source
extends pathConfig directoryn/aNoRelative to CWD
allowJsn/aYesn/aExpecting .js inputs
RunnerWorking directory used for includeExtra trap
tsc -p path/to/tsconfig.jsonThe config's own folderNone
ts-nodeThe config's own folderIgnores include for type checking by default
tsc --build (project references)Each referenced project's foldercomposite requires rootDir coverage
next buildProject rootNext.js generates its own config fields
vite buildProject root, via esbuildType checking is skipped entirely

Practical Edge Cases, Error Fixes & Deep Dive Code Examples

Case 1: The config lives one level too deep

A layout such as config/tsconfig.json with "include": ["src"] points at config/src. Use ../src/**/* or, better, keep the config at the package root and let tooling reference it.

bash
find . -name tsconfig.json -not -path "*/node_modules/*" -maxdepth 3

Case 2: extends inherits a relative include

The merged path is resolved against the file where the pattern was written. A shared base at packages/config/tsconfig.base.json with "include": ["src"] means every package inherits a path into packages/config/src. Shared bases should omit include entirely and leave it to leaves.

Case 3: The build stage ran before the sources were copied

A Dockerfile that copies only manifests, runs npm ci, then runs tsc before COPY . . will always fail with TS18003.

dockerfile
FROM node:22-alpine AS build WORKDIR /app COPY package*.json tsconfig*.json ./ RUN npm ci COPY . . RUN npm run build

Case 4: A generated types folder is the only input

Projects that generate types into types/ and expect the folder to exist can fail on a clean clone because git does not track empty directories. Commit a placeholder file or use files: [] with project references.

bash
mkdir -p types && printf 'export {};\n' > types/index.d.ts

Case 5: exclude with a negation that does not do what it reads like

{ "include": ["**/*.ts"], "exclude": ["node_modules", "**/*.test.ts"] }

Negated patterns inside exclude are supported, but ["node_modules", "!node_modules/keep-me"] still keeps almost nothing, because include never matched inside node_modules first. Put the tests in a separate config.

Case 6: references without composite

{ "files": [], "references": [{ "path": "./packages/core" }] }

A root config with files: [] is legitimate and does not raise TS18003 by itself, because references supplies the program. But if the referenced package lacks "composite": true, tsc --build skips it and the root looks empty again.

Common Compilation/Runtime Mistakes & Version Gotchas

  • Case sensitivity. macOS and Windows resolve Src/**/* to src/, Linux CI does not. An include that works locally can return zero inputs in the build container. Check the exact casing of the directory.
  • tsc version skew. TypeScript 5.x changed how include interacts with --outDir and how exclude defaults are computed; a lockfile that resolves a different compiler in CI than locally can change the input set without any config edit. Pin the compiler version.
  • Editor versus build. The language server may report none of this because it builds a program from the files you have open. TS18003 only appears on a real tsc run, so trust the CLI.
  • noEmit hides nothing. Setting noEmit: true does not skip input resolution; CI type checks still fail with TS18003.
  • Generated paths with spaces. An include such as My App/src/**/* needs no escaping in JSON, but shell wrappers that pass -p paths can break.

When you need to inspect the exact JSON that a build consumed, run it through the JSON formatter after --showConfig so nesting and duplicate keys become obvious. For comparing a working config against a broken one, the diff tool keeps the two files side by side. And when a path pattern is the suspect, the regex tester helps confirm what **/* actually matches before you rewrite it.

Primary references: the TypeScript tsconfig.json reference documents include, exclude, files and inheritance, and the TSConfig handbook chapter covers how extends is resolved.

Official references

primary documentation

The TypeScript documentation that defines the behaviour this guide explains.

Try matching browser tools

All tools

Small utilities that fit TypeScript work — they run entirely in this browser tab, so nothing you paste leaves your device.

All TypeScript guides

More in TypeScript

All TypeScript guides

The guides filed next to this one in TypeScript, in library order.