在VSCode中构建typescript时,我收到以下错误:
错误TS6082:只有' amd'和'系统'模块同时支持 --out。
我的设置如下:
tsconfig.json
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"out": "current/game.js",
"removeComments": true,
"sourceMap": false
}
}
.vscode / tasks.json:
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// args is the HelloWorld program to compile.
"args": [],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
尽管有错误,但game.js文件确实已创建并正常运行。
有人对可能导致此错误的原因有任何疑问吗?
答案 0 :(得分:32)
这意味着它所说的。您不能使用--out
/ --outFile
将模块捆绑在一起用于Node.js / CommonJS,因为CommonJS没有捆绑格式。只需不要为CommonJS使用该选项,并为每个输入TS模块文件发出相应的JS文件。