tsconfig.json: Build:No inputs were found in config file — how to fix

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

Introduction: Why doesn't TypeScript see my files?

\n\n

You 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.

\n\n

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.

\n\n

And yes, we'll speak in plain English, with lively examples. Let's go!

\n\n

What does the "Build:No inputs were found in config file" error mean?

\n\n

Translating 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.

\n\n

The error occurs in two typical situations:

\n
    \n
  • You just created tsconfig.json in an empty folder.
  • \n
  • You incorrectly configured the include, exclude, or rootDir fields.
  • \n
\n\n

Let's break down each cause in detail so you can not just copy a solution, but understand why it works.

\n\n

Reason #1: There are no TypeScript files in the project

\n\n

The 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.

\n\n

Example of the problem:

\n
my-project/\n├── tsconfig.json\n└── (nothing else)
\n\n

Run npx tsc — and you get the error. The solution is obvious: create at least one index.ts file.

\n\n

How to fix:

\n
my-project/\n├── tsconfig.json\n├── src/\n│   └── index.ts   # <-- Here it is, the savior!
\n\n

But what if the files exist and the error still appears? Then we dig deeper.

\n\n

Reason #2: Incorrect path specified in the include field

\n\n

The 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.

\n\n

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\n

In this example, the src folder is missing. The compiler honestly tries to find files matching the pattern src/**/*, finds nothing — and throws the error.

\n\n

How to fix:

\n
    \n
  • Check if the folder you specified in include exists.
  • \n
  • Make sure this folder contains .ts or .tsx files.
  • \n
  • Use relative paths. If your tsconfig.json is in the root and your sources are in src/, write "src/**/*".
  • \n
\n\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\n

Reason #3: Conflict between include and exclude

\n\n

Sometimes you specify a folder in include, but then in exclude you

Blogs

Book Recommendations