From 5e4e65c7c2ff63e1945a231c27ee4e9dabaa389b Mon Sep 17 00:00:00 2001 From: sarapli Date: Sat, 8 Feb 2020 15:00:47 +0800 Subject: [PATCH] fix: issues: Fails for import statement with no name #2 --- 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 }), + ]); + } + }), }, },