-
Notifications
You must be signed in to change notification settings - Fork 50
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
stop using optional deps to fix webpack #53
Comments
My webpack build also fails because it's missing tweetnacl, bcrypt-pbkdf, jsbn and ecc-jsbn. |
Any luck getting this to run on browser? |
These packages being misclassified is causing compatibility issues with certain build systems. This is an issue. |
Easy fix. Opened a PR #55 |
Do you have a specific error message that might be helpful to figure out what's going on that causes it not to work? The deps If webpack is not able to deal with the Sorry this has been sitting open for so long -- browser issues are not really a high priority for me (or the other people at Joyent who have worked on this module), and I can't really offer support for how to use |
@arekinath Well, with webpack, even if they MIGHT get required in some function...they still need to be included. If the code ends up in the browser, and then the function gets called, the browser needs to have the package already loaded. It's just how webpack works, and for good reason. Webpack doesn't know and can't know if you're going to call that function or not. All it knows is that you might, so the dependency needs to be bundled. Does that make sense? It's not a bug in webpack. It absolutely needs to work that way, and can't work any other way. At first glance, the way you are using optional dependencies makes sense. Unfortunately I think that is not the convention. Optional dependencies are almost always used for something that is more performant on a given system, but the module will run fine without them. They are definitely not intended for functionality that might not get called. I think the very simple fix is simply to move them into dependencies. Almost everyone has been getting them anyway since optional dependencies are almost always installed. This is just breaking certain uncommon build systems that expect people to use the flag properly. Please head into the rush issue I referenced above for an example |
Reviewed by: Cody Peter Mello <cody.mello@joyent.com>
Merged a change in the latest release based on @light24bulbs PR which moves all these into regular dependencies, and also changes the |
ecc-jsbn and tweetnacl appear to not be optional
The text was updated successfully, but these errors were encountered: