Skip to content

Commit

Permalink
Fix bug where npm package wildcard didn't work
Browse files Browse the repository at this point in the history
Signed-off-by: Vihan B <contact@vihan.org>
  • Loading branch information
vihanb committed Jun 23, 2017
1 parent 198cbd4 commit 67be892
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 67be892

Please sign in to comment.