2016-03-12 16 views
20

VSCodeでtypescriptですを構築するとき、私は次のエラーを取得--outと一緒にサポートされています。のみ 'AMD' と「システムのモジュールは

のTSconfigを:

error TS6082: Only 'amd' and 'system' modules are supported alongside --out.

私の設定を次のとおりです。 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ファイルが作成されて正常に実行されます。

このエラーの原因は何ですか?

+1

私はちょうどこのエラーに遭遇し、解決策を見つけるためにGoogleの検索を実行し、私は他の誰かがこれについて尋ねてきたことを喜んで見ました。わたしはそれを聞いたのです!ありがとう、自己! – OCDev

答えて

22

それは何を意味します。 CommonJSのバンドル形式がないため、--out/--outFileを使用してNode.js/CommonJSのモジュールを一緒にバンドルすることはできません。 CommonJSにはそのオプションを使用しないでください。対応するJSファイルは各入力TSモジュールファイルに対して出力されます。

+11

単に "module"を削除する: "commonjs"、この作業をしました。ありがとう! – OCDev

+2

同様に、「モジュール」に変更することもできます(「なし」)。 – ryanp102694

+0

VS 2017は "なし"の選択について文句を言う – StingyJack

関連する問題