stop using optional deps to fix webpack #53
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