--out旁边仅支持"amd"和"system"模块 [英] Only 'amd' and 'system' modules are supported alongside --out

查看:1166
本文介绍了--out旁边仅支持"amd"和"system"模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VSCode中构建打字稿时,出现以下错误:

When building typescript in VSCode, I get the following error:

错误TS6082:仅支持"amd"和"system"模块 --out.

error TS6082: Only 'amd' and 'system' modules are supported alongside --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文件确实已创建并正常运行.

Despite the error, the game.js file does get created and runs properly.

任何人都对导致此错误的原因有任何想法?

Anyone have any thoughts about what might cause this error?

推荐答案

它表示的意思.您不能使用--out/--outFile将Node.js/CommonJS的模块捆绑在一起,因为CommonJS没有捆绑格式.只需对CommonJS不使用该选项,每个输入的TS模块文件都会发出相应的JS文件.

It means what it says. You can’t use --out/--outFile to bundle modules together for Node.js/CommonJS, since there is no bundle format for CommonJS. Simply don’t use that option for CommonJS and corresponding JS files will be emitted for each input TS module file.

这篇关于--out旁边仅支持"amd"和"system"模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆