0

I'm on Linux, Visual Studio Code. I have a project that has several .ts (typescript) files, and I need to compile them all at once.

The problem is that I have those files in the /src folder, and I want to compile them to another folder, so I have to also specify the output folder.

Thanks

2 Answers 2

2

so I have to also specify the output folder.

Use outDir in tsconfig.json

Only using tasks.json

Then provide --outDir dirPath as a flag to tsc.

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

3 Comments

I don't seem to have a tsconfig.json... only tasks.json
then use --outDir compiler flag
would you add the tasks.json solution to your answer?
0

tsconfig.json

{
    "compilerOptions": {
        "sourceMap":  true, 
        "outFile": "main.js"
    },
    "files": [
        "main.ts",
        "car.ts"
    ]
}

tasks.json

You have to OMIT the "args" option inside "tasks.json", only then will the arguments in tsconfig.json be used! I found the answer here: http://github.com/Microsoft/typescript/wiki/tsconfig.json. It says: When input files are specified on the command line, tsconfig.json files are ignored

from https://stackoverflow.com/a/33874319/4339170

Comments

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.