When attempting to integrate timbre.js (npm version) with Browserify, I encountered an issue where require statements for optional dependencies were enclosed in a try statement (check the source here). This resulted in a browserify build error displaying:
Error: Cannot find module 'lame' from 'such/and/such/a/location'
This problem seems similar to an issue raised by another user a few months back. Is this issue specific to this library's implementation or is it common among libraries with optional CommonJS-required dependencies?
I attempted to use a browserify transform ('remove-try-require') to remove require statements from try blocks, but it was not effective.
Are there established best practices for addressing such challenges? Is using a try-catch require statement considered bad practice? What are alternative ways of managing optional dependencies?
Any insights would be greatly appreciated!
(P.S. - A temporary workaround could involve obtaining those optional dependencies, although I prefer not to do so.)