4

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

1 Answer 1

5

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

For more information check TS docs.

Sign up to request clarification or add additional context in comments.

1 Comment

I can see where some confusion comes from. In my newly created tsconfig.json the commented out "noEmit" is set to true. In most sane places this would be the default, but here on my setup it isn't - files were still emitted. By uncommenting this line, no more js files were output until I changed it to false or commented it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.