improve module loading interoperability for babel

This commit is contained in:
vvakame
2015-06-21 16:15:21 +09:00
parent 25ecada731
commit 54a4e9e57d
20 changed files with 223 additions and 0 deletions

View File

@@ -2709,6 +2709,17 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
}
else {
if (node.flags & NodeFlags.Default) {
if (compilerOptions.module === ModuleKind.CommonJS || compilerOptions.module === ModuleKind.AMD || compilerOptions.module === ModuleKind.UMD) {
write("Object.defineProperty(exports, \"__esModule\", {");
writeLine();
increaseIndent();
// default value of configurable, enumerable, writable are `false`.
write("value: true");
writeLine();
decreaseIndent();
write("};");
writeLine();
}
if (languageVersion === ScriptTarget.ES3) {
write("exports[\"default\"]");
} else {