目前,我正在尝试tsconfig.json中的新扩展特性,它允许开发人员拥有一个基本的tsconfig.json,其他模块可以扩展/修改这个特性。
它正在发挥作用,尽管并不像预期的那样。不知怎么的,要想做到这一点,唯一的办法就是在父母和孩子的信任中指定compileroptions.lib。
parent.tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"lib": [ // Lib compiler options defined!!!
"dom",
"es6"
]
},
"exclude": [
"node_modules"
],
"awesomeTypescriptLoaderOptions": {
"resolveGlobs": true,
"forkChecker": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}child.tsconfig.json (预期)
{
"extends": "../parent.tsconfig.json",
} child.tsconfig.json (需要工作)
{
"extends": "../parent.tsconfig.json",
"compilerOptions": {
"lib": [ //Have to specify lib again ==> Double-u-t-f
"dom",
"es6"
]
}
}请就这一问题提出一些建议。
干杯
发布于 2017-09-29 13:08:10
你一切都做对了。您的tsconfig.json文件应该位于当前项目的根目录中。再次检查parent.tsconfig.json文件的路径是否在child.tsconfig.json中正确设置。
发布于 2022-05-19 08:55:08
在我的示例中,我在父文件夹中运行tsc命令,它只使用父文件夹中的tsconfig.json,而不使用子文件夹中的tsconfig.json。
当在子文件夹中运行tsc命令时,或者在父文件夹中运行tsc -p child_folder_name时,它也可以工作。
https://stackoverflow.com/questions/41101971
复制相似问题