Skip to main content

No inputs were found in config file in TypeScript

The error “No inputs were found in config file” occurs when we try to build a project that does not contain any TypeScript files. To solve the error, add an empty file with a .ts extension in your project’s root directory and restart your IDE if necessary.

tsc# error TS18003: No inputs were found in config file.# Specified 'include' paths were '["**/*"]' and# 'exclude' paths were '["node_modules"]'.

Step 1: Make sure your project contains at least one .ts file

If your project does not contain any files with a .ts extension, you can create an empty file with a .ts extension to silence the error.

Create a file called placeholder.ts with the following contents:

export {};

If you have set the include array in your tsconfig.json file, make sure to create the file in the specified directory. For example:

{  "compilerOptions": {    // ... your options  },  "include": ["src/**/*"],  "exclude": ["node_modules"]}

In this case, the include array looks for files in the src directory, so you would have to create the placeholder.ts file in src.

If you haven’t set the include array, create the placeholder.ts file in your project’s root directory (next to tsconfig.json).

Step 2: Restart your IDE and TypeScript server

If you already have files in your project, restart your IDE and TypeScript server. Sometimes, VSCode can glitch and need a reboot. In that case, open a file with a .ts or .js extension and restart the editor for it to pick it up.

[Fixed]: RuntimeError: dictionary changed size during iteration

Step 3: Check the exclude array in your tsconfig.json file

Another thing that can cause the error is if you add all the files in your TypeScript project to the exclude array by mistake.

For example:

{  "compilerOptions": {    // ... your options  },  "include": ["src/**/*"],  "exclude": ["node_modules"]}

Make sure to only exclude the files that you want to filter out. If you have an exclude pattern that matches all of the files in your project, that’s the cause of the error.

Step 4: Create a tsconfig.json file to silence the error

If you don’t use TypeScript in your project, but still get the error and a restart of your IDE doesn’t help things, you can create a tsconfig.json file in your project’s root directory to simply silence the error.

{  "compilerOptions": {    "allowJs": false,    "noEmit": true  },  "exclude": ["src/**/*", "your-other-src/**/*"],  "files": ["placeholder.ts"]}

And create a placeholder.ts file right next to the tsconfig.json file:

export {};

Restart your IDE and the error should be resolved.

The tsconfig.json file from the example above looks to exclude all of your source files from compilation and just needs a single file as an entry point (placeholder.js) in the example.

The whole point of this tsconfig.json file is to silence the error in projects that don’t use TypeScript. By setting the allowJs option to false and the noEmit option to true, the TypeScript compiler will not emit any output files.

The exclude array specifies a list of files and directories to ignore, and the files array specifies a list of files to include in the project. By specifying an empty files array and excluding all of your source files, the TypeScript compiler will not have any input files to work with and will not produce any output. This effectively silences the “No inputs were found in config file” error in projects that don’t use TypeScript.

Conclusion on “No inputs were found in config file in TypeScript”

The error “No inputs were found in config file” occurs when we try to build a project that does not contain any TypeScript files. To solve the error, follow these steps:

  1. Make sure your project contains at least one file with a .ts extension. If it doesn’t, you can create an empty file with a .ts extension to silence the error.
  2. Restart your IDE and TypeScript server.
  3. Check the include and exclude arrays in your tsconfig.json file to make sure they are correctly set.
  4. If you don’t use TypeScript in your project, you can create a tsconfig.json file in your project’s root directory with the files and exclude options to silence the error.

By following these steps, you should be able to resolve the “No inputs were found in config file” error in your TypeScript project.

Comments

Popular posts from this blog

Best Health Insurance For Students in USA

Whether you're a domestic or international student studying in the USA, having health insurance coverage is not just a luxury, it's a necessity. With the high cost of healthcare in the USA, having the best health insurance for students in the USA can provide you with peace of mind while you focus on your studies. Understanding the Need for Health Insurance for Students Being a student, the likelihood of you being healthy and not needing frequent medical attention is quite high. But life is unpredictable, and emergencies can arise at any time. If a sudden injury or illness strikes, the resulting healthcare costs can become a major financial burden if you are uninsured. With the steep price of medical care in the United States, even a simple trip to the emergency room can lead to exorbitant bills. By having a good health insurance plan, students can mitigate these financial risks. Such plans cover a wide array of medical services, ranging from regular preventive care to prolonge...

Top 10 Web Hosting Companies in 2024

 As the world of internet grows, the need for high-quality, reliable web hosting has never been more important. In this blog post, we'll delve into the top 10 web hosting companies in 2024, examining their features, pricing, and how they stack up against each other. Exploring The Importance of Reliable Web Hosting The lifeblood of the digital universe is web hosting. It's the sturdy anchor keeping every website afloat in the sea of the internet. Reliable web hosting is your ally in carving out your own piece of the online world, ensuring your site remains accessible, loading with speed, and guarding your precious data securely. It's like owning prime real estate in the metropolis of the internet, where your digital presence is steadfast, standing tall among the rest. This, in a nutshell, is the essential role of a trustworthy web hosting service. It's not just about the space; it's about the quality, reliability, and safety of that space. The Rise of Green Hostin...

Export 'Switch' (imported as 'Switch') was not found in 'react-router-dom'

Are you encountering the error “attempted import error: ‘switch’ is not exported from ‘react-router-dom'” or variations like “export switch was not found in react-router-dom” or “switch is not exported from react-router”? If so, you’re not alone—this is a common problem that many React developers face when using the ‘react-router-dom’ library. In this blog post, we’ll explore the causes of this error and provide a few solutions to help you fix it and get your ‘React application up and running. What Causes the “Export ‘Switch’ (imported as ‘Switch’) was not found in ‘react-router-dom'” Error? This error occurs when a developer tries to import the ‘Switch’ component from the ‘react-router-dom’ library, but the component is not actually exported by the library. For example, the following code will trigger the error: import { Switch } from 're...