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

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.

主站蜘蛛池模板: 广元市| 西盟| 康乐县| 安阳市| 定安县| 余庆县| 景洪市| 兴业县| 依兰县| 疏附县| 镇远县| 邹城市| 汨罗市| 福安市| 长白| 蓬安县| 元江| 鹤岗市| 云阳县| 富裕县| 常德市| 定结县| 忻城县| 松阳县| 得荣县| 凤山市| 天峨县| 平南县| 宕昌县| 乌拉特前旗| 娄烦县| 曲麻莱县| 曲阜市| 常山县| 新乡市| 江山市| 沈丘县| 新蔡县| 庆安县| 齐齐哈尔市| 邳州市|