Introduction: Why doesn't TypeScript see my files?
\n\nYou open a TypeScript project, run the build, and suddenly — bam! — a cold shower in the form of a message: tsconfig.json: Build:No inputs were found in config file. Sound familiar? If you've ever dealt with TypeScript configuration, you've probably seen this error. It scares beginners and annoys professionals. But don't rush to tear your hair out or curse Microsoft.
In this article, we won't just show you how to quickly silence the error. We'll break down its anatomy: why it occurs, what scenarios lead to it, and how to configure tsconfig.json so you never see this message again. This will be useful both for those just starting to learn TypeScript and for those who want to understand the compiler's mechanics more deeply.
And yes, we'll speak in plain English, with lively examples. Let's go!
\n\nWhat does the "Build:No inputs were found in config file" error mean?
\n\nTranslating from compiler language to human language, TypeScript is telling you: "I don't know which files to compile. You told me to build the project, but didn't specify where the source files are." The tsc compiler looks for .ts and .tsx files, but finds none in the directories you (or it) specified.
The error occurs in two typical situations:
\n- \n
- You just created
tsconfig.jsonin an empty folder. \n - You incorrectly configured the
include,exclude, orrootDirfields. \n
Let's break down each cause in detail so you can not just copy a solution, but understand why it works.
\n\nReason #1: There are no TypeScript files in the project
\n\nThe most trivial but common reason. You created tsconfig.json in a folder that doesn't contain a single .ts file. The compiler honestly looks — and finds nothing.
Example of the problem:
\nmy-project/\n├── tsconfig.json\n└── (nothing else)\n\nRun npx tsc — and you get the error. The solution is obvious: create at least one index.ts file.
How to fix:
\nmy-project/\n├── tsconfig.json\n├── src/\n│ └── index.ts # <-- Here it is, the savior!\n\nBut what if the files exist and the error still appears? Then we dig deeper.
\n\nReason #2: Incorrect path specified in the include field
\n\nThe include field in tsconfig.json tells the compiler: "Look for files here." If you specified a non-existent folder or made a mistake in the path, the compiler won't find anything.
Incorrect configuration:
\n{\n "compilerOptions": {\n "target": "ES2020",\n "module": "commonjs",\n "outDir": "./dist"\n },\n "include": ["src/**/*"] // But the src folder doesn't exist!\n}\n\nIn this example, the src folder is missing. The compiler honestly tries to find files matching the pattern src/**/*, finds nothing — and throws the error.
How to fix:
\n- \n
- Check if the folder you specified in
includeexists. \n - Make sure this folder contains
.tsor.tsxfiles. \n - Use relative paths. If your
tsconfig.jsonis in the root and your sources are insrc/, write"src/**/*". \n
Correct configuration:
\n{\n "compilerOptions": {\n "target": "ES2020",\n "module": "commonjs",\n "outDir": "./dist"\n },\n "include": ["src/**/*"]\n}\n// Make sure the src folder exists and contains .ts files\n\nReason #3: Conflict between include and exclude
\n\nSometimes you specify a folder in include, but then in exclude you