From 86641b6f7e6837bad6f0de55948a1cb8b1474526 Mon Sep 17 00:00:00 2001 From: Sara2009 Date: Fri, 17 Jul 2020 21:13:10 +0800 Subject: [PATCH] fix: issues: Fails for import statement with no name #2 (#4) Co-authored-by: sarapli --- index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index e924f70..d0334b2 100644 --- a/index.js +++ b/index.js @@ -36,10 +36,18 @@ module.exports = function(/*babel*/) { // const jssObject = cssToJss({ code }); // writeJssFile(jssObject, src); - babelData.replaceWithMultiple([ - classesMapConstAst({ classesMap, importNode }), - putStyleIntoHeadAst({ code }), - ]); + // issues: Fails for import statement with no name #2 + if (importNode.local) { + babelData.replaceWithMultiple([ + classesMapConstAst({ classesMap, importNode }), + putStyleIntoHeadAst({ code }), + ]); + } else { + babelData.replaceWithMultiple([ + putStyleIntoHeadAst({ code }), + ]); + } + }), }, },