mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-25 05:29:07 -05:00
Fix #7922: Only bundle if module==AMD or module==System
This commit is contained in:
@@ -2285,10 +2285,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
function onBundledEmit(host: EmitHost) {
|
||||
const moduleKind = getEmitModuleKind(options);
|
||||
const moduleEmitEnabled = moduleKind === ModuleKind.AMD || moduleKind === ModuleKind.System;
|
||||
// Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified
|
||||
const bundledSources = filter(host.getSourceFiles(), sourceFile =>
|
||||
!isDeclarationFile(sourceFile) // Not a declaration file
|
||||
&& (!isExternalModule(sourceFile) || !!getEmitModuleKind(options))); // and not a module, unless module emit enabled
|
||||
&& (!isExternalModule(sourceFile) || moduleEmitEnabled)); // and not a module, unless module emit enabled
|
||||
|
||||
if (bundledSources.length) {
|
||||
const jsFilePath = options.outFile || options.out;
|
||||
|
||||
@@ -23,8 +23,4 @@ declare class Foo {
|
||||
x: string;
|
||||
y: number;
|
||||
}
|
||||
declare module "inputFile3" {
|
||||
export var foo: number;
|
||||
export var bar: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ EmitSkipped: false
|
||||
FileName : tests/cases/fourslash/inputFile2.js.map
|
||||
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AACA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,qBAAC,GAAG,IAAC,IAAI,EAAG,CAAE,EAAG,CAAA"}FileName : tests/cases/fourslash/inputFile2.js
|
||||
var y = "my div";
|
||||
var x = React.createElement("div", {name: y});
|
||||
var x = React.createElement("div", { name: y });
|
||||
//# sourceMappingURL=inputFile2.js.mapFileName : tests/cases/fourslash/inputFile2.d.ts
|
||||
declare var React: any;
|
||||
declare var y: string;
|
||||
|
||||
Reference in New Issue
Block a user