I am currently in the process of developing an NPM package for a Typescript project using gulp and browserify. The challenge I'm facing is that the consumer of the package does not utilize modules. Thus, I am working on creating a standalone bundle with Browserify.
One concern I have is whether bundling all the dependencies could pose an issue. It seems that the bundled js file simply encapsulates my dependencies (three and hammerjs) within the global namespace. The consumer also includes another component that uses hammerjs (similar version), leading me to wonder which version of hammerjs will be available for my application. How do other NPM packages that function in a standalone manner address this?
I attempted to exclude dependencies in Browserify by setting bundleExternal to false or removing them individually then including those libraries in the browser. However, this approach did not resolve the issue as I encountered a "Cannot find module 'hammerjs'" error in the console. I came across information on how to use the exclude feature in Browserify and successfully browserified all the dependencies separately. Despite this workaround, it seems equivalent to bundling them together directly since I cannot directly include the hammer.min.js file from their website.
TL;DR
What is the correct method for bundling a modular Typescript NPM package and handling dependencies for usage in a non-module-supported application?