From 89b39289c827ec1b19cad07857a75821b6dd04e7 Mon Sep 17 00:00:00 2001 From: Wee Date: Sun, 14 Apr 2019 02:50:07 +0800 Subject: [PATCH] fix(babel-plugin-export-metadata): fix re-export default (#790) (#791) --- other-packages/babel-plugin-export-metadata/src/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/other-packages/babel-plugin-export-metadata/src/index.js b/other-packages/babel-plugin-export-metadata/src/index.js index 041d8703e..5b8d87dfa 100644 --- a/other-packages/babel-plugin-export-metadata/src/index.js +++ b/other-packages/babel-plugin-export-metadata/src/index.js @@ -52,12 +52,17 @@ const insertNodeExport = t => (path, state) => { addFileMetaProperties(t, path, filename, name) } else if (declarations) { for (declaration of declarations) { - declarationName = get(declaration, 'id.name') + const declarationName = get(declaration, 'id.name') addFileMetaProperties(t, path, filename, declarationName) } } else if (specifiers) { for (specifier of specifiers) { - specifierName = get(specifier, 'local.name') + let specifierName = get(specifier, 'local.name') + specifierName = + specifierName === 'default' + ? get(specifier, 'exported.name') + : specifierName + addFileMetaProperties(t, path, filename, specifierName) } }