From 67be8922267a8521f646176807f783978f75a024 Mon Sep 17 00:00:00 2001 From: Vihan B Date: Fri, 23 Jun 2017 14:01:54 -0700 Subject: [PATCH] Fix bug where npm package wildcard didn't work Signed-off-by: Vihan B --- package.json | 2 +- src/index.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e1e0b4f..c251224 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-wildcard", - "version": "2.0.0", + "version": "2.1.0", "description": "`import` now works with directories", "main": "lib/index.js", "scripts": { diff --git a/src/index.js b/src/index.js index 74d5764..c430c0f 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,10 @@ export default function (babel) { ImportDeclaration(path, state) { let node = path.node, dec; var src = path.node.source.value; + + // Don't do anything if not a relative path + // if if not a relative path then a module + if (src[0] !== "." && src[0] !== "/") return; let addWildcard = false, // True if should perform transform wildcardName; // Name of the variable the wilcard will go in @@ -141,7 +145,6 @@ export default function (babel) { // Special behavior if 'filterNames' if (filterNames.length > 0) { - console.log(fancyName, name, id); let importDeclaration = t.importDeclaration( [t.importDefaultSpecifier( t.identifier(fancyName)