vihanb / babel-plugin-wildcard

Wildcard imports import a directories JS files
MIT License
186 stars 27 forks source link

Conflict when importing everything from a regular package #3

Closed joaoanes closed 7 years ago

joaoanes commented 7 years ago

First of all, thanks for publishing this! Really helps clean up code 👍 .

We've started using this in a project we're working on, and when performing wildcard imports of existing modules instead of folders (for example, import * as Animatable from 'react-native-animatable'), the import is understandably broken.

I expected this plugin to understand if we're importing a folder or importing methods from a module, or at least a way to disable the wildcard import behaviour on a per-import basis, am I correct in this expectation? Is there a way I can import * from a module? Thanks!

vihanb commented 7 years ago

Okay, I've added a condition to detect a module or a folder (commit 67be8922267a8521f646176807f783978f75a024) for this. Previously it would assume all import * as A imports to be 'wildcard' imported, but now it'll use default behavior if it detects a module. I've published this in npm v2.1.0, let me know if you encounter any problems after that