babel-plugin-module-resolver: Problems With Proxyquire
Proxyquire is a library for replacing a module’s dependencies (for testing). Unfortunately however it works based on paths, and module-resolver changes those paths in a way that seems incompatible with proxyquire (eg. if you define an alias of ~/ then try to bring a module in with proxyquire using '~/some/path' it fails).
However, I don’t fully understand how/when module-resolver is applied, so my hope is that someone more knowledgeable with the plug-in might be able to suggest a strategy for using the two libraries together (eg. by explaining what paths module-resolver generates so that one can use those paths with proxyquire). Failing that, just having a knowledgeable source confirm that it’s impossible to use the two together would still be (at least somewhat) helpful.
Thanks.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (18 by maintainers)
That’s totally reasonable, but then would it maybe make sense to have a quick note about
proxyquire/passthrough functions/transformFunctionssomewhere in the docs? Even just a sentence or two (similar to the ESLint note) might help otherproxyquireusers.Hmm… Yeah… After reflection, maybe it’s not a good idea to have a super generic name in the
transformFunctionsoption 😕