Only 'amd' and 'system' modules are supported alongside --out

TypescriptVisual Studio-CodePhaser Framework

Typescript Problem Overview


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

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

My settings are as follows:

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

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

Anyone have any thoughts about what might cause this error?

Typescript Solutions


Solution 1 - Typescript

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOCDevView Question on Stackoverflow
Solution 1 - TypescriptC SnoverView Answer on Stackoverflow