【笔记】TS编译器配置
source link: https://loli.fj.cn/2023/06/07/TS%E7%BC%96%E8%AF%91%E5%99%A8%E9%85%8D%E7%BD%AE/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
TS编译器配置学习笔记
TS编译器配置文件
- TS编译器
tsc
会根据当前目录下的tsconfig.json
配置文件进行编译
include
:指定包含,被指定的文件都会被编译
**
:任意目录*
:任意文件
include
:指定不包含,被指定的文件都不会被编译extends
:继承配置,继承被指定的配置文件files
:指定需要被编译的单个ts文件compilerOptions
:编译器选项
target
:编译的JS版本,默认为ES3
ES3
、ES5
、ES6
、ES2015
、ES2016
、ES2017
、ES2018
、ES2019
、ES2020
、ESNext
module
:模块化规范
none
、commonjs
、amd
、system
、umd
、es6
、ES2015
、ES2020
、ESNext
lib
:指定用到的库outDir
:编译后的JS存放的目录outFile
:合并所有ts编译后的文件为一个JS文件,指定这个文件的存放路径allowJs
:是都将JS文件编译,默认为falsecheckJs
:是否检查JS文件的语法是否符合TS规范,默认为falseremoveComments
:是否在编译时移除注释,默认为falsenoEmit
:是否不生成编译后的JS文件,默认为falsenoEmitOnError
:出错时是否不生成编译后的JS文件,默认为falsealwaysStrict
:是否在编译后的JS文件使用严格模式,默认为falsenoImplicitAny
:是否在TS文件中不允许隐式的any类型,默认为falsenoImplicitThis
:是否在TS文件中不允许不明确的this,默认为falsestrictNullChecks
:是否严格的检查空值,默认为falsestrict
:是否开启所有的严格检查,默认为false
{
"include": [
"./src/**/*"
],
"exclude": [],
"include": "",
"files": [],
"compilerOptions": {
"target": "ES6",
"module": "ES6",
"lib": ["dom"],
"outDir": "./dist",
"outFile": "./dist/app.js",
"allowJs": false,
"checkJs": false,
"removeComments": false,
"noEmit": false,
"alwaysStrict": false,
"noImplicitAny": false,
"noImplicitThis": false,
"strictNullChecks": false,
"strict": false
}
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK