2016-03-12 10 views
20

Solo 'amd' e moduli di 'sistema' Quando si costruisce dattiloscritto in VSCode, ottengo il seguente errore:sono supportati fianco --out

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

mie impostazioni sono le seguenti:

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" 
} 

Nonostante l'errore, il file game.js viene creato e viene eseguito correttamente.

Qualcuno ha qualche idea su cosa potrebbe causare questo errore?

+1

Mi sono appena imbattuto in questo errore e ho eseguito una ricerca su Google per trovare la soluzione ed ero felice di vedere che qualcun altro aveva chiesto questo. Ecco, sono stato io a chiederlo! Grazie! – OCDev

risposta

22

Significa ciò che dice. Non è possibile utilizzare --out/--outFile per raggruppare i moduli insieme per Node.js/CommonJS, poiché non è disponibile il formato bundle per CommonJS. Semplicemente non usare questa opzione per CommonJS e i corrispondenti file JS verranno emessi per ogni file del modulo TS di input.

+11

Semplicemente rimuovendo "module": "commonjs", ha fatto questo lavoro. Grazie! – OCDev

+2

Allo stesso modo, è possibile anche passare a "module": "none". – ryanp102694

+0

VS 2017 si lamenta della scelta di "nessuno" – StingyJack