Igal
Igal

Reputation: 6103

Output .map files for typescript to specific folder in IntelliJ IDEA

I configured my IntelliJ IDEA to compile all .ts file to specific folder. Here's the configuration:

enter image description here

It works just fine. Here's my folder structure:

js/
  | - typescript/
        | - __test.ts
  | - __test.js
  | - __test.js.map
  | - otherfile.js

The problem is that it outputs the .map files to the same folder as .js files. Since I'll be having a lot of .js files, the folder will look cluttered.

Is there a possibility to make IntelliJ IDEA to output .map files to a specific folder? I couldn't find any info about that...

Thank you!

Upvotes: 1

Views: 1171

Answers (2)

Justin Smith
Justin Smith

Reputation: 433

in the Typescript Compiler options... I added --outDir ./.map. This affects both .js and .js.map files.

Upvotes: 0

lena
lena

Reputation: 93758

tsc compiler doesn't have options for this - .map files, when generated, are always placed to the same folder as .js files. See https://www.typescriptlang.org/docs/handbook/compiler-options.html for the list of available options.

if you like to move generated files to a different location, you can use build tools like Gulp, Grunt or Webpack. But, if you go this way, make sure that sourcemaps URL is properly generated (you need using --mapRoot cli option that controls the reference to the map file in the .js file to let the debugger know where to look for sourcemaps).

see TypeScript tsconfig Output files in certain folders, for example

Upvotes: 1

Related Questions