官术网_书友最值得收藏!

tsconfig.json

As we have seen, there are lots of different switches that we can apply to the compilation process, and repeatedly specifying these on the command line is a little clunky. Luckily, we can specify these options in a file called tsconfig.json. The compiler options we have looked at in previous sections are defined in a compilerOptions field without the "--" prefix.

Let's take a look at an example:

  1. Let's create a tsconfig.json file with the following content:
{
"compilerOptions": {
"target": "esnext",
"outDir": "dist",
"module": "es6",
"moduleResolution": "node",
"sourceMap": true,
"noImplicitReturns": true,
"noImplicitAny": true
}
}
  1. Let's run a compile without specifying the source file and any flags:
tsc

The compilation will run fine, with the transpiled JavaScript being output to the dist folder along with a source map file.

主站蜘蛛池模板: 睢宁县| 大理市| 永平县| 荣成市| 苗栗市| 枣庄市| 田林县| 浦城县| 宜宾市| 栾城县| 万年县| 嘉义市| 肥西县| 三原县| 新营市| 图木舒克市| 云浮市| 宝清县| 娄底市| 永寿县| 崇左市| 安乡县| 和田县| 林周县| 麻城市| 老河口市| 吉安市| 宣化县| 嘉峪关市| 亚东县| 日照市| 新源县| 偃师市| 建宁县| 仲巴县| 大庆市| 白朗县| 绥阳县| 景德镇市| 霍城县| 梅河口市|