[systemjs] Fix: export star alongside with named export (#12612)
This commit is contained in:
committed by
GitHub
parent
58d2f41930
commit
2338b052ad
@@ -74,34 +74,36 @@ function constructExportCall(
|
||||
stringSpecifiers: Set<string>,
|
||||
) {
|
||||
const statements = [];
|
||||
if (exportNames.length === 1) {
|
||||
statements.push(
|
||||
t.expressionStatement(
|
||||
t.callExpression(exportIdent, [
|
||||
t.stringLiteral(exportNames[0]),
|
||||
exportValues[0],
|
||||
]),
|
||||
),
|
||||
);
|
||||
} else if (!exportStarTarget) {
|
||||
const objectProperties = [];
|
||||
for (let i = 0; i < exportNames.length; i++) {
|
||||
const exportName = exportNames[i];
|
||||
const exportValue = exportValues[i];
|
||||
objectProperties.push(
|
||||
t.objectProperty(
|
||||
stringSpecifiers.has(exportName)
|
||||
? t.stringLiteral(exportName)
|
||||
: t.identifier(exportName),
|
||||
exportValue,
|
||||
if (!exportStarTarget) {
|
||||
if (exportNames.length === 1) {
|
||||
statements.push(
|
||||
t.expressionStatement(
|
||||
t.callExpression(exportIdent, [
|
||||
t.stringLiteral(exportNames[0]),
|
||||
exportValues[0],
|
||||
]),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
const objectProperties = [];
|
||||
for (let i = 0; i < exportNames.length; i++) {
|
||||
const exportName = exportNames[i];
|
||||
const exportValue = exportValues[i];
|
||||
objectProperties.push(
|
||||
t.objectProperty(
|
||||
stringSpecifiers.has(exportName)
|
||||
? t.stringLiteral(exportName)
|
||||
: t.identifier(exportName),
|
||||
exportValue,
|
||||
),
|
||||
);
|
||||
}
|
||||
statements.push(
|
||||
t.expressionStatement(
|
||||
t.callExpression(exportIdent, [t.objectExpression(objectProperties)]),
|
||||
),
|
||||
);
|
||||
}
|
||||
statements.push(
|
||||
t.expressionStatement(
|
||||
t.callExpression(exportIdent, [t.objectExpression(objectProperties)]),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
const exportObj = path.scope.generateUid("exportObj");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user