From 0a4fdc155eb91535d996419dd3afcee1af315f48 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Wed, 11 Oct 2017 15:02:12 -0700 Subject: [PATCH] [fix] babel plugin 'source' check --- babel/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/babel/index.js b/babel/index.js index fba6b599..2f16ed08 100644 --- a/babel/index.js +++ b/babel/index.js @@ -106,7 +106,7 @@ module.exports = function({ types: t }) { visitor: { ImportDeclaration(path) { const { source, specifiers } = path.node; - if (source.value === 'react-native' && specifiers.length) { + if (source && source.value === 'react-native' && specifiers.length) { const imports = specifiers .map(specifier => { if (t.isImportSpecifier(specifier)) { @@ -129,7 +129,7 @@ module.exports = function({ types: t }) { }, ExportNamedDeclaration(path) { const { source, specifiers } = path.node; - if (source.value === 'react-native' && specifiers.length) { + if (source && source.value === 'react-native' && specifiers.length) { const exports = specifiers .map(specifier => { if (t.isExportSpecifier(specifier)) {