title: Basic webpack not working for button click function - Uncaught Reference error: undefined
body: <p>I have a basic HTML page with a button:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    ...
  &lt;/head&gt;
  &lt;body&gt;
      &lt;button id="button" onclick="uclicked()"&gt;Click me&lt;/button&gt;
      &lt;script src="./bundle.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and an <code>app.js</code>:</p>
  
  <pre><code>//(function(){
      console.log('started up')
      function uclicked(){
          console.log('You clicked');
      }
  //})();
  </code></pre>
  
  <p>webpack is installed and <code>webpack --watch</code> succeeds. The webpack.config.js is:</p>
  
  <pre><code>module.exports={
      entry: './app.js',
      output: {
          path: __dirname,
          filename: 'bundle.js'
      }
  }
  </code></pre>
  
  <p>When I load the page <code>console.log</code> is working but when I push the button I get <code>Uncaught ReferenceError: uclicked is not defined</code>.</p>
  
  <p>If I replace <code>&lt;script src="./bundle.js"&gt;&lt;/script&gt;</code> with <code>&lt;script src="./app.js"&gt;&lt;/script&gt;</code> and bypass webpack the button clicks fine. Why doesn't this basic webpack setup work?</p>