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

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.

主站蜘蛛池模板: 台东市| 长海县| 玉山县| 姜堰市| 巴东县| 盐边县| 白玉县| 北流市| 皮山县| 林甸县| 南靖县| 庆云县| 广东省| 淮滨县| 原阳县| 龙岩市| 桦川县| 庆城县| 陆丰市| 宜丰县| 睢宁县| 将乐县| 双牌县| 南陵县| 东乡族自治县| 大宁县| 当雄县| 阳江市| 清涧县| 平果县| 宝坻区| 阳朔县| 镇远县| 鸡西市| 恩平市| 达孜县| 天峻县| 商南县| 福海县| 称多县| 西和县|