title: JavaScript function won't trigger when called in HTML file during Parcel build
body: <p>I have a basic HTML form page that is linked to a JavaScript file. Both files exist in a Node project and I am using Parcel as a bundler (because I eventually want to convert this to TypeScript). </p>
  
  <p>When I run the html file in the browser, the JavaScript function will trigger, but when I run the Parcel build, the index.html will compile, but the JavaScript function won't trigger. It recognizes the js file because I can call dom queries outside the function. </p>
  
  <p>When I check in the console I get the error:</p>
  
  <pre><code>(index):12 Uncaught ReferenceError: validationFunction is not defined
      at HTMLInputElement.onchange
  </code></pre>
  
  <p>But this doesn't make sense because the function is defined outside the Parcel build. </p>
  
  <p>How can I get the index.html page to recognize the JavaScript function when it is compiled with Parcel?</p>
  
  <p>The index.js file is below:</p>
  
  <pre><code>function validationFunction(event) {
    event.preventDefault();
    var div;
    div = document.getElementById("appendedText");
    div.innerHTML += "hello world";
  }
  </code></pre>
  
  <p>The index.html is:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;meta charset="UTF-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="ie=edge" /&gt;
      &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;form action="" method="post"&gt;
          First name:&lt;br /&gt;
          &lt;input onChange="validationFunction(event)" type="text" name="firstname" /&gt;&lt;br /&gt;
          &lt;input type="submit" name="Submit" /&gt;
      &lt;/form&gt;
      &lt;h1&gt;&lt;/h1&gt;
      &lt;div id="appendedText"&gt;&lt;/div&gt;
      &lt;script src="index.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>And the package.json is:</p>
  
  <pre><code>{
    "name": "typescriptprojects",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "dev": "parcel index.html"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "typescript": "^3.5.3"
    },
    "dependencies": {
      "parcel-bundler": "^1.12.3"
    }
  }
  </code></pre>