title: Syntax error in react app. Only on first load
body: <p>Im having some trouble figuring out exactly what the issue is here.</p>
  
  <p>Whenever I deploy a new version of my react application, I get this error:</p>
  
  <p><code>SyntaxError: expected expression, got '&lt;'</code></p>
  
  <p>However, the interesting part of the issue is it ONLY happens on the first load. If you press refresh on the browser, the issue goes away, and doesn't happen again until a new version is pushed out.</p>
  
  <p>From what I can gather from other stack overflow posts:</p>
  
  <p><a href="https://stackoverflow.com/questions/50659063/react-firebase-error-after-build-and-deploy-syntaxerror-expected-expression-go">React firebase error after build and deploy SyntaxError: expected expression, got &#39;&lt;&#39;</a></p>
  
  <p>The issue seems to lie in the index.html file, where I am loading a js script, but html is getting loaded, and the '&lt;' character throws the error. Also, I never see this error when developing, only once built and deployed.</p>
  
  <p>I am left scratching my head since the error only happens on first load.</p>
  
  <p>Here is my index.html file:</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, shrink-to-fit=no"&gt;
      &lt;link rel="manifest" href="%PUBLIC_URL%/manifest.json"&gt;
      &lt;link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-touch-icon.png"&gt;
      &lt;link rel="icon" type="image/png" href="%PUBLIC_URL%/favicon-32x32.png" sizes="32x32"&gt;
      &lt;link rel="icon" type="image/png" href="%PUBLIC_URL%/favicon-16x16.png" sizes="16x16"&gt;
      &lt;link rel="mask-icon" href="%PUBLIC_URL%/safari-pinned-tab.svg" color="#5bbad5"&gt;
      &lt;link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet"&gt;
      &lt;link rel="stylesheet/less" type="text/css" href="/color.less" &gt;
      &lt;meta name="theme-color" content="#ffffff"&gt;
      &lt;title&gt;Kirs&lt;/title&gt;
  
      &lt;script&gt;(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/w1ycmr5d';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()&lt;/script&gt;
      &lt;script src="https://js.stripe.com/v3/"&gt;&lt;/script&gt;
      &lt;script src="https://maps.googleapis.com/maps/api/js?key=omitted&amp;libraries=places"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;noscript&gt;
        You need to enable JavaScript to run this app.
      &lt;/noscript&gt;
      &lt;div id="root"&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I use netlify to deploy my app, if that makes any difference.</p>
  
  <p>netlify.toml:</p>
  
  <pre><code># Global settings applied to the whole site.
  # “base” is directory to change to before starting build, and
  # “publish” is the directory to publish (relative to root of your repo).
  # “command” is your build command.
  
  [build]
    base    = ""
    publish = "build"
    command = "REACT_APP_STAGE=dev npm run build"
  
  # Production context: All deploys to the main
  # repository branch will inherit these settings.
  [context.production]
    command = "REACT_APP_STAGE=prod npm run build"
  
  # Deploy Preview context: All Deploy Previews
  # will inherit these settings.
  [context.deploy-preview]
    command = "REACT_APP_STAGE=dev npm run build"
  
  # Branch Deploy context: All deploys that are not in
  # an active Deploy Preview will inherit these settings.
  [context.branch-deploy]
    command = "REACT_APP_STAGE=dev npm run build"
  
  # Always redirect any request to our index.html
  # and return the status code 200.
  [[redirects]]
      from    = "/*"
      to      = "/index.html"
      status  = 200
  </code></pre>
  
  <p>Thanks for any help!</p>