Using Node.js modules in HTML
I have the following Node.js project (which is a Minimal Working Example of my problem): module1.js : module.exports = function() { return "this is module1!"; }; module2.js : var module1 = require('./module1'); module.exports = function() { return module1()+" and this is module2!"; }; server.js : var module2 = require('./module2'); console.log(module2()); // prints: "this is module1! and this is module2!" Now I want to create a client.html file that will also use module2.js. Here is what I tried (and failed): naive version : <script src='module2.js'></script> <script>alert(module2());</script>