title: javascript require doesn't work inside html
body: <p>I'm writing html code that involves js code. Below a simple example:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC &gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;h2&gt;Use JavaScript to Change Text&lt;/h2&gt;
  &lt;p&gt;This example writes "Hello JavaScript!" into an HTML element with id="demo":&lt;/p&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;
  &lt;script&gt;
      var net     = require('net');
      var sleep   = require('sleep');
      var element = document.getElementById("demo");
      element.innerHTML = "Hello JavaScript!";
      sleep(1)
  &lt;/script&gt; 
  </code></pre>
  
  <p>
  </p>
  
  <p>Unfortunately "Hello JavaScript!" doesn't appear when I browse the above file with my browser. Looking inside the debug console I can see the folowing message:</p>
  
  <pre><code>ReferenceError: require is not defined
  </code></pre>
  
  <p>So it seems that require is not defined inside the html code but I've written a small test.js file as below:</p>
  
  <pre><code>var net = require('net');
  var sleep = require('sleep');
  sleep.sleep(1)
  </code></pre>
  
  <p>and then I run it with</p>
  
  <pre><code>node test.js.
  </code></pre>
  
  <p>No errors, everything works fine, require is available and sleep and net as well. Why the code inside html file doesn't work?</p>