Browse a building with dependencies that require statements in a try-catch block
I'm trying to use timbre.js (npm version) with Browserify, but it requires operators for optional dependencies in a try statement ( see source here ). This breaks the browser build with a message like
Error: Cannot find module 'lame' from 'such/and/such/a/location'
It seems like someone had the same problem months ago , but is it really a problem with this particular library implementation, or is it very much related to other libraries that have optional CommonJS dependent dependencies?
I tried a browser conversion ('remove-try-require'), which should strip the required expressions from the try blocks, but that didn't seem to work.
Is there a common practice for dealing with things like this? Is the try-catch attempt an invalid statement? What other ways can handle additional dependencies?
Thank!
(PS - A quick solution would be to get these optional dependencies, but I don't want them.)
source to share