miltone
miltone

Reputation: 4721

TypeScript compiler: save compiled file into the same directory as source file

I would like to compile TypeScript file (ts) to JavaScript (js) and map (js.map) files into the same directory as the source file.

I already try this in my tsconfig.json file :

{
  "compilerOptions": {
    "sourceMap": true,
    "inlineSources": true,
    "outDir": "./",
   }
}

or

{
  "compilerOptions": {
    "sourceMap": true,
    "inlineSources": true,
    "outDir": ".",
   }
}

But nothing happened. What is the correct config for that ? Is there a --outDir parameters options to compile in the same directory ?

In PhpStorm, can I use a variable options perhaps in my config compiler TypeScript ?

enter image description here

Upvotes: 0

Views: 865

Answers (1)

Derek
Derek

Reputation: 997

Remove the outDir setting to output the compiled .js and .js.map next to the Typescript files.

Try this:

{
  "compilerOptions": {
    "sourceMap": true,
    "inlineSources": true,
   }
}

Upvotes: 1

Related Questions