Fix T6953,T2541 export-from statement renamed default issue
- Use `interopRequireDefault` helper if local name is default. Via 59naga/babel-plugin-add-module-exports#20
This commit is contained in:
@@ -295,7 +295,11 @@ export default function () {
|
||||
} else if (specifier.isExportDefaultSpecifier()) {
|
||||
// todo
|
||||
} else if (specifier.isExportSpecifier()) {
|
||||
topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression(ref, specifier.node.local)));
|
||||
if (specifier.node.local.name === "default") {
|
||||
topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression(t.callExpression(this.addHelper("interopRequireDefault"), [ref]), specifier.node.local)));
|
||||
} else {
|
||||
topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression(ref, specifier.node.local)));
|
||||
}
|
||||
nonHoistedExportNames[specifier.node.exported.name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user