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

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.

主站蜘蛛池模板: 盐山县| 瑞昌市| 渝北区| 韶山市| 乌兰察布市| 旌德县| 石柱| 黄冈市| 安泽县| 紫云| 微山县| 乐都县| 庆云县| 平舆县| 三台县| 榆林市| 嘉祥县| 依安县| 洛隆县| 景德镇市| 治多县| 宜兴市| 常山县| 始兴县| 临朐县| 汕头市| 三台县| 灵山县| 龙海市| 衡山县| 厦门市| 东至县| 神池县| 西和县| 嘉义县| 乌鲁木齐县| 博客| 乐亭县| 囊谦县| 沙坪坝区| 虎林市|