title: Webpack Facebook Login Button error
body: <p>I am using Webpack to bundle my files. I want to provide FB login to my users. I have created my FB app and have included in my HTML like this:</p>
  
  <pre><code>&lt;script&gt;
      window.fbAsyncInit = function() {
          FB.init({
              appId            : 'xxxxxx',
              autoLogAppEvents : true,
              xfbml            : true,
              version          : 'v2.10'
          });
          FB.AppEvents.logPageView();
      };
  
      (function(d, s, id){
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/sdk.js";
          fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I also have a div:</p>
  
  <pre><code>&lt;div class="fb-login-button btn-fb"
   data-max-rows="1"
   data-size="large"
   data-button-type="continue_with"
   data-show-faces="false"
   data-auto-logout-link="false"
   data-use-continue-as="false"
   scope="public_profile, email"
   onlogin="checkLoginState()"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I deploy, I can see FB dialog however it gives an error :</p>
  
  <pre><code>"sdk.js:110 Uncaught ReferenceError: checkLoginState is not defined"
  </code></pre>
  
  <p>The function checkLoginState is defined in my login.js file which is an entry point in webpack.</p>
  
  <p>My guess is checkLoginState needs to be exposed to global scope to fix this error. So I tried </p>
  
  <pre><code>window.checkLoginState = function() {
  ...
  }
  </code></pre>
  
  <p>However it did not work.</p>
  
  <p>Based on my testing I am seeing this behavior occurs only when I add another JS call in the checkLoginState function i.e : </p>
  
  <pre><code>window.checkLoginState = function () { 
    console.log("checkLoginState &gt;&gt;&gt;"); 
    socialAuth.checkFBLoginStatus(); 
  }; 
  </code></pre>
  
  <p>If I remove the <code>socialAuth.checkFBLoginStatus()</code> call, then <code>checkLoginState</code> is found.</p>
  
  <p>I am looking for help to get me past this error.</p>