mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
Add compiler error for incompatible module formats
This commit is contained in:
@@ -225,7 +225,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
|
||||
file(outFile, prereqs, function() {
|
||||
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
|
||||
var options = "--module commonjs --noImplicitAny --noEmitOnError";
|
||||
var options = "--noImplicitAny --noEmitOnError";
|
||||
|
||||
// Keep comments when specifically requested
|
||||
// or when in debug mode.
|
||||
|
||||
@@ -2262,14 +2262,6 @@
|
||||
"code": 6063
|
||||
},
|
||||
|
||||
"Specify JSX code generation: 'preserve' or 'react'": {
|
||||
"category": "Message",
|
||||
"code": 6080
|
||||
},
|
||||
"Argument for '--jsx' must be 'preserve' or 'react'.": {
|
||||
"category": "Message",
|
||||
"code": 6081
|
||||
},
|
||||
"Enables experimental support for ES7 decorators.": {
|
||||
"category": "Message",
|
||||
"code": 6065
|
||||
@@ -2302,6 +2294,18 @@
|
||||
"category": "Message",
|
||||
"code": 6072
|
||||
},
|
||||
"Specify JSX code generation: 'preserve' or 'react'": {
|
||||
"category": "Message",
|
||||
"code": 6080
|
||||
},
|
||||
"Argument for '--jsx' must be 'preserve' or 'react'.": {
|
||||
"category": "Message",
|
||||
"code": 6081
|
||||
},
|
||||
"Only 'amd', 'umd', and 'system' modules are supported alongside --{0}.": {
|
||||
"category": "Error",
|
||||
"code": 6082
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -457,11 +457,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
};
|
||||
|
||||
let bundleEmitDelegates: Map<(node: SourceFile, startIndex: number, resolvePath?: boolean) => void> = {
|
||||
[ModuleKind.ES6]: () => {},
|
||||
[ModuleKind.ES6]() { },
|
||||
[ModuleKind.AMD]: emitAMDModule,
|
||||
[ModuleKind.System]: emitSystemModule,
|
||||
[ModuleKind.UMD]: emitUMDModule,
|
||||
[ModuleKind.CommonJS]: () => {},
|
||||
[ModuleKind.CommonJS]() { },
|
||||
};
|
||||
|
||||
if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) {
|
||||
|
||||
@@ -1063,6 +1063,11 @@ namespace ts {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower));
|
||||
}
|
||||
|
||||
// Cannot specify module gen that isn't amd, umd, or system with --out
|
||||
if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.UMD && options.module !== ModuleKind.System) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_umd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile"));
|
||||
}
|
||||
|
||||
if (options.noEmit) {
|
||||
if (options.out) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
|
||||
Reference in New Issue
Block a user