title: SyntaxError: import declarations may only appear at top level of a module. Using express, no webpack
body: <p>I am trying to import a npm module in the front end script. It is saying modules must be on top level to import but it is at the top level from what I can tell. Maybe my web server is messing with my code. I am unsure. </p>
  
  <p>The code is ugly right now because I am trying to get everything situated.</p>
  
  <p>I have already tried </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script type='module' src='./js/scripts.js'&gt;&lt;/script&gt;
  </code></pre>
  
  <p>scripts.js</p>
  
  <pre class="lang-js prettyprint-override"><code>import axios from 'axios';
  
  
  function getQueryStringValue (key) {  
      return decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&amp;\\?]" + encodeURIComponent(key).replace(/[\.\+\*]/g, "\\$&amp;") + "(?:\\=([^&amp;]*))?)?.*$", "i"), "$1"));  
  }  
  const query = getQueryStringValue('code');
  
  class chime {
      constructor(code) {
          this.code = code;
      };
      async logIn() {
          const response = await axios.post('url', {
              'client_id': '',
              'client_secret': '',
              'grant_type': '',
              'redirect_uri': 'https://localhost:3000',
              'code': this.code
          });
  
          console.log(response);
      }
      test() {
          console.log(this.code);
      }
  }
  
  if (query) {
      const client = new chime(query);
  
      client.logIn();
  
  };
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>var express = require('express')
  var fs = require('fs')
  var https = require('https')
  var app = express()
  const path = require('path');
  
  const publicPath = path.join(__dirname, '../public');
  const port = 3000;
  
  app.use(express.static(publicPath));
  
  
  
  app.get('*', (req, res) =&gt; {
      res.sendFile(path.join(publicPath, '/index.html'));
  });
  
  
  https.createServer({
    key: fs.readFileSync(path.join(__dirname + '/ssl/server.key')),
    cert: fs.readFileSync(path.join(__dirname+ '/ssl/server.cert'))
  }, app)
      .listen(3000, function () {
      console.log('Example app listening on port 3000! Go to https://localhost:3000/')
      });
  
  </code></pre>
  
  <p>I am wanting to be able to import npm modules.</p>