diff --git a/src/index.js b/src/index.js index ed9a63f..044d3fb 100644 --- a/src/index.js +++ b/src/index.js @@ -160,7 +160,7 @@ export default declare(({ }, ExportNamedDeclaration(path, state) { const { node } = path; - if (node.specifiers.length > 0 && node.specifiers[0].local.name === 'default') { + if (node.specifiers.length > 0 && node.specifiers[0].local && node.specifiers[0].local.name === 'default') { const exportName = node.specifiers[0].exported.name; const filename = parseFilename(node.source.value).name; applyPlugin(exportName, node.source.value, path, state, true, filename); diff --git a/test/fixtures/test-export-all-as.jsx b/test/fixtures/test-export-all-as.jsx new file mode 100644 index 0000000..ee2c097 --- /dev/null +++ b/test/fixtures/test-export-all-as.jsx @@ -0,0 +1 @@ +export * as foo from 'bar'; diff --git a/test/sanity.js b/test/sanity.js index b04db4c..81ea4b8 100644 --- a/test/sanity.js +++ b/test/sanity.js @@ -177,3 +177,13 @@ transformFile('test/fixtures/test-export-default-as.jsx', { if (err) throw err; console.log('test/fixtures/test-export-default-as.jsx', result.code); }); + +transformFile('test/fixtures/test-export-all-as.jsx', { + presets: ['airbnb'], + plugins: [ + inlineReactSvgPlugin, + ], +}, (err, result) => { + if (err) throw err; + console.log('test/fixtures/test-export-all-as.jsx', result.code); +});