What is the best way to load CommonJS modules as client-side JavaScript code in the browser?
CommonJS modules put their functionality in the module.exports
namespace and are usually included using require(pathToModule)
in a server-side script. Loading them on the client cannot work the same way (require needs to be replaced, asynchronousness needs to be taken into account, etc.).
I have found module loaders and other solutions: Browserify, RequireJS, yabble, etc. or ways to simply alter the modules. What do you consider the best way and why?