Resolving TypeScript Build Error: No Inputs Found in tsconfig.json

Nov 19, 2025 · Programming · 11 views · 7.8

Keywords: TypeScript | tsconfig.json | Build Error | ASP.NET Core | Configuration File

Abstract: This article provides an in-depth analysis of the common 'No inputs were found in config file' build error in TypeScript projects. By examining the working mechanism of include and exclude options in tsconfig.json configuration files, combined with ASP.NET Core project examples, it offers multiple solutions including adding empty TypeScript files, configuring include paths, and restarting development environments. The article starts from the root cause of the error and progressively explains configuration principles and repair methods to help developers thoroughly understand and resolve such build issues.

Error Phenomenon Analysis

During ASP.NET Core project development, when attempting to build TypeScript code, developers may encounter the following error message:

error TS18003: Build:No inputs were found in config file 'Z:/Projects/client/ZV/src/ZV/Scripts/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["../wwwroot/app","node_modules/*"]'.
1>         The command exited with code 1.
1>       Done executing task "VsTsc" -- FAILED.

This error indicates that the TypeScript compiler failed to find any compilable input files in the specified configuration file. Error code TS18003 clearly identifies the root cause of the build process interruption.

Configuration File Deep Analysis

Let's carefully analyze the problematic tsconfig.json configuration file:

{
  "compileOnSave": true,
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es5", "dom" ],
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "outDir": "../wwwroot/app/",
    "removeComments": false,
    "sourceMap": true,
    "target": "es6"
  },
  "exclude": [
    "../wwwroot/app",
    "node_modules/*"
  ]
}

This configuration contains complete compiler option settings but lacks the crucial include configuration item. The TypeScript compiler by default searches for all TypeScript files in the current directory and its subdirectories, but when no .ts files actually exist in the directory, this error is triggered.

Root Cause Investigation

The TypeScript compiler's working mechanism requires at least one valid TypeScript file to initiate the compilation process. This design prevents unnecessary compilation operations in empty projects or directories that don't contain TypeScript code. When the configuration file doesn't explicitly specify include paths and there are indeed no .ts files in the directory, the compiler cannot determine the target files to compile.

Solution Implementation

Method 1: Add Empty TypeScript File

The most direct solution is to add an empty TypeScript file to the TypeScript scripts folder (where the tsconfig.json file is located). This file can serve as a simple placeholder:

// empty.ts
// This file ensures TypeScript compiler has at least one input file

After creating this file, the TypeScript compiler can identify at least one input file and normally start the compilation process.

Method 2: Configure Include Paths

If the project does contain TypeScript files but they are located in other directories, you can specify file paths by explicitly configuring the include option:

{
  "compilerOptions": {
    "moduleResolution": "node"
    // Other compiler options...
  },
  "include": [
    "./src/**/*.ts"
  ],
  "exclude": [
    "../wwwroot/app",
    "node_modules/*"
  ]
}

This configuration method explicitly tells the compiler to search for all .ts files in the ./src directory and its subdirectories.

Method 3: Restart Development Environment

In some cases, particularly when using editors like Visual Studio Code, the TypeScript server may experience caching issues. Restarting the TypeScript server can force re-evaluation of the configuration file:

  1. Open any .ts or .tsx file
  2. Use shortcuts to open the command palette (Windows/Linux: Ctrl+Shift+P, Mac: Cmd+Shift+P)
  3. Execute the "TypeScript: Restart TS server" command

Configuration Best Practices

To avoid such problems, it's recommended to correctly configure the tsconfig.json file during project initialization:

{
  "compilerOptions": {
    // Compiler options configuration
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules",
    "dist",
    "build"
  ]
}

This configuration ensures the compiler clearly knows where to find source files while excluding directories that don't need compilation.

Environment Compatibility Considerations

It's worth noting that this problem may manifest differently in various development environments. In Visual Studio 2015 Update 3, updates to the TypeScript toolchain may have changed the default file search behavior. Ensuring that the development environment's TypeScript version matches project requirements is an important measure to prevent such issues.

Conclusion

The TypeScript build error 'No inputs were found in config file' typically stems from mismatches between configuration files and project structure. By understanding the compiler's working mechanism and adopting methods such as adding placeholder files, correctly configuring include paths, or restarting development environments, developers can effectively resolve this issue. Proper project structure and configuration management are key to avoiding such build errors.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.