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

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.

主站蜘蛛池模板: 屏东县| 西和县| 泗洪县| 康平县| 赫章县| 湾仔区| 隆尧县| 富裕县| 阜城县| 肃宁县| 崇礼县| 临漳县| 鹿泉市| 加查县| 蒙山县| 鹤峰县| 井研县| 垫江县| 湘乡市| 高密市| 长春市| 永安市| 高邮市| 通州区| 梓潼县| 进贤县| 鄂托克前旗| 河北区| 桂东县| 饶阳县| 津市市| 梅河口市| 成安县| 丰宁| 东山县| 泸水县| 长兴县| 江油市| 台东县| 奈曼旗| 胶南市|