简体   繁体   中英

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:

在此处输入图片说明

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!

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM