Search code examples
typescripttypescript-typingstsconfig

tsc command not compiling to outDir


I am pretty new to tsconfig.json configuration, but I am simply wanting to compile my src directories to compiled javascript like it should, but it's just not creating the outDir folder with the compiled code.

This is my tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "target": "es2017",
    "skipLibCheck": true,
    "noImplicitAny": true,
    "noEmit": true,
    "moduleResolution": "node",
    "sourceMap": true,

    "outDir": "dist",

    "baseUrl": ".",
    "jsx": "react",
    "paths": {
      "MyApplicationTypes" : ["@types/MyApplicationTypes/index.d.ts"],
      "*": [
        "node_modules/*"
      ]
    },
    "typeRoots" : ["@types"]
  },
  "include": [
    "server/**/*",
    "client/**/*"
  ],
  "exclude" : [
    "./client/dist",
    "./client/.cache",
    "./dist",
    "./.cache"
  ]
}

My npm run build command is just plain tsc and it runs and completes without any errors or any other output.

The dist/ does not created and even if I create the folder manually, it stays empty. What is going on?!

My folder structure is pretty simple containing both a server and client:

- project
  - client
    - index.html
    - index.tsx
    ... etc
  - server
    - index.ts 
    ... etc

Any reason why? My tsconfig is pretty simple


Solution

  • You have noEmit set to true. As said here, noEmit is used for type checking only.

    For more information check TS docs.