Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Webpack? #62

Closed
holyjak opened this issue May 8, 2015 · 8 comments
Closed

Support for Webpack? #62

holyjak opened this issue May 8, 2015 · 8 comments

Comments

@holyjak
Copy link

holyjak commented May 8, 2015

Hello,

Thanks for this great library! I wonder whether there are any plans to support also Webpack in addition to Browserify. How large job is it to add support for it?

Thank you!

@holyjak
Copy link
Author

holyjak commented May 8, 2015

I see that rewire runs on Node but also supports webpack so may be that is a reasonable option? (Though I prefer proxyquire's API)

@thlorenz
Copy link
Owner

thlorenz commented May 8, 2015

Have a look at proxyqurieify and proxyquire-universal.
They work with browserify via plugin or transform.
Not sure if webpack supports that.

FWIW all this is explained in the second paragraph of the README

@bendrucker
Copy link
Collaborator

No plans to support Webpack specifically since neither of us use it. If someone really wanted to invest the time I'd be willing to help offer guidance. Otherwise it's just not very high on my list.

I'd really recommend not using rewire. Using eval to write unit tests is a really bad idea in principle, but it can also create a ton of compatibility headaches as well. Most transpilers (e.g. Babel) can change your variable names and then everything breaks.

@holyjak
Copy link
Author

holyjak commented May 12, 2015

Thank you. I have looked briefly at the code of proxyqurieify, proxyquire-universal, and rewire-webpack and it seems to be no simple matter to port proxyquire to a new build tool so I guess I will need to use rewire :-(

@thlorenz
Copy link
Owner

Actually this is a good reason to switch to browserify.
We are opinionated obviously, but it's modular plugable nature makes packages like proxyquireify possible.
Or you stick with webpack until you run into the next nice thing you can't have ;)

@jedrichards
Copy link

Just noticed a new Babel plugin inspired by rewire. Thought it might be of interest: https://github.com/speedskater/babel-plugin-rewire

@volkanunsal
Copy link

I'm coming here after trying the babel-plugin-rewire plugin. It doesn't support function imports. I had high hopes for this library, but I can't use it without Webpack support.

@djskinner
Copy link

This may be useful for Webpack users looking for proxyquire-like functionality: https://github.com/plasticine/inject-loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants