这是我的tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "ES3",
"lib": ["ESNext"],
"strict": false,
"moduleResolution": "node",
"module": "commonjs",
"types": ["d.ts"],
"removeComments": true
},
"include": ["*.ts"]
}
我的项目有许多.ts文件和一个类型为d.ts/index.d.ts
的文件。
我只想编译项目中的一个.ts文件,just one,并将其输出到一个扩展名为.rr
的文件中。
--outFile
可以工作,但我不知道应该告诉CLI什么,以便应用tsconfig.json
中的所有设置。目前我收到了一大堆关于TS2304: Cannot find name 'blah'
的错误
outFile
正在使用以下配置。outFile
只能与amd
或system
模块一起使用。我在lib
面临问题的地方尝试了您的配置。如果我删除它,一切都会如预期的那样工作。
{
"compilerOptions": {
"target": "es5",
"module": "system",
"outFile": "./output/test.rr",
"rootDir": "./",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": [
"./testfile.ts"
]
}
您的配置在进行更改、模块和删除lib和类型后,
{
"compileOnSave": true,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"outFile": "./output/testfile11.rr",
"target": "ES3",
"strict": false,
"moduleResolution": "node",
"module": "system",
"removeComments": true
},
"include": [
"testfile.ts"
]
}