简体   繁体   English

将打字稿的 .map 文件输出到 IntelliJ IDEA 中的特定文件夹

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

I configured my IntelliJ IDEA to compile all .ts file to specific folder.我将 IntelliJ IDEA 配置为将所有 .ts 文件编译到特定文件夹。 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.问题是它将 .map 文件输出到与 .js 文件相同的文件夹。 Since I'll be having a lot of .js files, the folder will look cluttered.由于我将有很多 .js 文件,文件夹看起来会很混乱。

Is there a possibility to make IntelliJ IDEA to output .map files to a specific folder?是否有可能让 IntelliJ IDEA 将 .map 文件输出到特定文件夹? 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. tsc 编译器没有这方面的选项 - .map文件在生成时总是与.js文件放在同一文件夹中。 See https://www.typescriptlang.org/docs/handbook/compiler-options.html for the list of available options.有关可用选项的列表,请参阅https://www.typescriptlang.org/docs/handbook/compiler-options.html

if you like to move generated files to a different location, you can use build tools like Gulp, Grunt or Webpack.如果您想将生成的文件移动到不同的位置,您可以使用 Gulp、Grunt 或 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).但是,如果您采用这种方式,请确保正确生成了源映射 URL(您需要使用--mapRoot cli 选项来控制对.js文件中映射文件的引用,以让调试器知道在哪里查找源映射)。

see TypeScript tsconfig Output files in certain folders , for example例如,请参阅特定文件夹中的 TypeScript tsconfig 输出文件

in the Typescript Compiler options... I added --outDir ./.map .在打字稿编译器选项中...我添加了--outDir ./.map This affects both .js and .js.map files.这会影响.js.js.map文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IntelliJ IDEA 无法识别 Javascript/Typescript 文件中的特定数据库架构 - IntelliJ IDEA does not recognise specific database schema in Javascript/Typescript files 在IntelliJ IDEA中,如何在使用TypeScript时从“查找使用情况”结果中过滤出JS文件? - In IntelliJ IDEA, how can you filter JS files out of “Find Usage” results when using TypeScript? 当打字稿文件位于“ ./src”中时,如何构建输出文件夹 - How to build to output folder when the typescript files are located in './src' 已编译TypeScript的输出文件夹 - Output folder for compiled TypeScript IntelliJ IDEA显示错误的JavaScript文件 - IntelliJ IDEA displaying JavaScript files with errors 如何在IDEA Intellij中配置新文件的创建 - How to configure creation of new files in IDEA Intellij IntelliJ IDEA 2019.2社区版中设置打字稿项目 - Set a typescript project in IntelliJ IDEA 2019.2 Community edition Intellij Idea-将Typescript编译为Javascript并保留目录结构 - Intellij Idea - compiling Typescript to Javascript and keeping directory structure 使用intellij-idea从TypeScript中的根路径导入模块 - Import module from root path in TypeScript with intellij-idea IntelliJ IDEA 中 JSDoc 类型的 map-like object - JSDoc type of map-like object in IntelliJ IDEA
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM