Attempt to reuse node.js code in a browser

Source code available on


nodular.js works when served by a web server only, because modern browsers won't allow XMLHttpRequest to download a local file. This restriction is motivated by obvious security concerns.

Here is a link open this page from one of our web servers: Open from a web server


Download and run the compatibility code, that creates a global _nodularJS_ object:
<script src="../../nodular.js"></script>
Basic setup:


"Module" without export





Basic and a bit less basic exports






Exported function





Multiple requires, re-requires, chained requires and more








Wait until all requires have executed, then require a file that doesn't exist

The error will be clearly shown in the console:
Uncaught URIError: ./nosuchfile.js not accessible, status: 404, (required by ./Wrong.js ◀ ./RequireWrong.js ◀ test5_script).