Correctly requeue CallExpression in AMD transform (#5497)

* Correctly requeue the define()-CallExpression

* Use pushContainer
This commit is contained in:
Daniel Tschinder
2017-09-10 02:33:35 +02:00
committed by Justin Ridgewell
parent 6560a29c36
commit 5565e1b406
7 changed files with 50 additions and 2 deletions

View File

@@ -128,13 +128,15 @@ export default function({ types: t }) {
factory.expression.body.directives = node.directives;
node.directives = [];
node.body = [
node.body = [];
path.pushContainer("body", [
buildDefine({
MODULE_NAME: moduleName,
SOURCES: sources,
FACTORY: factory,
}),
];
]);
},
},
},

View File

@@ -0,0 +1 @@
export default function () {}

View File

@@ -0,0 +1,9 @@
define(["exports"], function (exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = function () {};
});

View File

@@ -0,0 +1,7 @@
{
"plugins": [
"external-helpers",
"transform-es2015-modules-amd",
"transform-es3-member-expression-literals"
]
}

View File

@@ -0,0 +1 @@
export default function () {}

View File

@@ -0,0 +1,21 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.actual = mod.exports;
}
})(this, function (exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = function () {};
});

View File

@@ -0,0 +1,7 @@
{
"plugins": [
"external-helpers",
"transform-es2015-modules-umd",
"transform-es3-member-expression-literals"
]
}