fix default exported classes without a name (#4518)
* fix default exported classes without a name This correctly requeues class without name so the es3 transform can transform the default keyword. * Replace phabricator issue number with github
This commit is contained in:
committed by
Henry Zhu
parent
590ad4d24f
commit
cbbc1c7333
@@ -267,13 +267,18 @@ export default function () {
|
||||
]);
|
||||
} else {
|
||||
path.replaceWith(buildExportsAssignment(defNode, t.toExpression(declaration.node)));
|
||||
|
||||
// Manualy re-queue `export default class {}` expressions so that the ES3 transform
|
||||
// has an opportunity to convert them. Ideally this would happen automatically from the
|
||||
// replaceWith above. See #4140 for more info.
|
||||
path.parentPath.requeue(path.get("expression.left"));
|
||||
}
|
||||
} else {
|
||||
path.replaceWith(buildExportsAssignment(t.identifier("default"), declaration.node));
|
||||
|
||||
// Manualy re-queue `export default foo;` expressions so that the ES3 transform
|
||||
// has an opportunity to convert them. Ideally this would happen automatically from the
|
||||
// replaceWith above. See T7166 for more info.
|
||||
// replaceWith above. See #4140 for more info.
|
||||
path.parentPath.requeue(path.get("expression.left"));
|
||||
}
|
||||
exportDefaultFound = true;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export default class {}
|
||||
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = class {};
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"transform-es2015-modules-commonjs",
|
||||
"transform-es3-member-expression-literals",
|
||||
"transform-es3-property-literals"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export default function () {}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports["default"] = function () {};
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"transform-es2015-modules-commonjs",
|
||||
"transform-es3-member-expression-literals",
|
||||
"transform-es3-property-literals"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export default class Foo {}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
class Foo {}
|
||||
exports["default"] = Foo;
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"transform-es2015-modules-commonjs",
|
||||
"transform-es3-member-expression-literals",
|
||||
"transform-es3-property-literals"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export default function bat () {}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = bat;
|
||||
function bat() {}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"transform-es2015-modules-commonjs",
|
||||
"transform-es3-member-expression-literals",
|
||||
"transform-es3-property-literals"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user