ts之 tsconfig.json 配置文件

ts之 tsconfig.json 配置文件

  • tsc --init

include和exclude 属性

{
    
    
  "include":["./app.ts"],
  "exclude":["./app.ts"], // 排除 编译app.ts
  "compilerOptions": {
    
    
 	}
}

target属性

{
    
     
	"compilerOptions": {
    
    
    // es2016 高版本; es5 具有兼容性
    "target": "es2016",   
	}
}

allowJs属性

{
    
     
	"compilerOptions": {
    
    
    // 是否允许js文件
    "allowJs": true,   
	}
}

编译输出的目录 outDir属性

{
    
     
	"compilerOptions": {
    
    
    "outDir": "./",  // || ./dist等
	}
}

module属性

{
    
     
	"compilerOptions": {
    
    
    // ES6 、commonjs 、amd
    "module": "commonjs", 
	}
}

sourceMap属性

{
    
     
	"compilerOptions": {
    
    
    "sourceMap":true, // 是否编译有生产源文件
    "strict" : true, // 严格模式
	}
}

outFile属性 输出的文件存放在index.js下

{
    
     
	"compilerOptions": {
    
    
    // "outFile": "./lib/index.js",
    "outFile": "./",
	}
}

猜你喜欢

转载自blog.csdn.net/weixin_47409897/article/details/129185650