dropinrequire.js is a drop-in replacement for commonjs module in a browser. No server to run, No preprocessing of javascript files. It is very simple it needs only 20-lines of js. It is designed for rapid prototyping, not for production (see details). If you are in a rush, are using node.js and are willing to share code with your browser without hassle, dropinrequire.js is for you.
You just include this in your webpage
<script type="text/javascript" src="./dropin_require.js"></script>
And after that you can use require(filename) to import your node module in the
web browser. Suppose you got a module
foobar.js
exports.foo = "bar";
then this html will display bar
.
Here it is a example to show, and not tell.
<script src="../dropin_require.js";></script> <script> alert( require('./foobar.js').foo ); </script>
The code is available on github under MIT license and has been written by Jerome Etienne. That's it. No fuss no muss.