https://github.com/zeit/ncc#readme
gcc的node版, 由webpack和rullup两位作者开发
用于js和ts的打包, 零配置, 不过还是需要tsonfig.json
简单版
{
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
},
"exclude": ["node_modules", "**/*.test.ts"]
}
支持 ?. !.等高级语法
let obj = {
a:{
b:{
c:'d'
}
}
}
console.log(obj?.a)
console.log(obj?.a!.b)
console.log(obj?.a?.b!)
来源:oschina
链接:https://my.oschina.net/ahaoboy/blog/3178246