speedskater / babel-plugin-rewire

A babel plugin adding the ability to rewire module dependencies. This enables to mock modules for testing purposes.
842 stars 90 forks source link

Add documentation regarding "tree-shaking" functionality in plugin #167

Open natalzia-paperless opened 7 years ago

natalzia-paperless commented 7 years ago

I spent a good amount of time today digging into why some of my internal un-exported functions were available to the __GetDependency__ function and others weren't. It turns out that (as far as I can tell) this plugin only makes used functions/variables available through the GetDependency function. That is, if you define a function but never call it in the file, it isn't available to GetDependency. While I agree that this is great functionality, I think it would be extremely helpful to note this somewhere in the docs so people don't go on a wild goose hunt trying to figure out why only some dependencies are undefined.

speedskater commented 7 years ago

@natalzia-paperless thanks for pointing this out. I will add it to the README but it will take some more days.

natalzia-paperless commented 7 years ago

Not a problem @speedskater, thanks for the quick response!