title: Implement Firebase with Blazor WebAssembly
body: <p>I'm seeking to add the Firebase CDN to Blazor WebAssembly via JavaScript interopability, however it seems to not be working.</p>
  <p>Specifically, in <code>wwwroot/index.html</code> I have:</p>
  <pre><code>&lt;body&gt;
  
      &lt;!-- ... --&gt;
  
      &lt;script src=&quot;_framework/blazor.webassembly.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://www.gstatic.com/firebasejs/9.9.3/firebase-app.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://www.gstatic.com/firebasejs/9.9.3/firebase-auth.js&quot;&gt;&lt;/script&gt;
  
      &lt;script&gt;
  
          var firebaseSetup = () =&gt; {
  
              var firebaseConfig = {
                  apiKey: &quot;[Removed]&quot;,
                  authDomain: &quot;[Removed]&quot;,
                  projectId: &quot;[Removed]&quot;,
                  storageBucket: &quot;[Removed]&quot;,
                  messagingSenderId: &quot;[Removed]&quot;,
                  appId: &quot;[Removed]&quot;,
                  measurementId: &quot;[Removed]&quot;
              };
  
              firebase.initializeApp(firebaseConfig);
              const auth = firebase.auth();
  
          }
  
  
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  <p>And in <code>Pages/Login.razor</code> I have:</p>
  <pre><code>@inject IJSRuntime JSRuntime
  
  @*My HTML code here*@
  
  @code {
      public async void HandleValidFormSubmitted()
      {
          await JSRuntime.InvokeVoidAsync(&quot;alert&quot;, &quot;Hi JavaScript!&quot;); // This works
          await JSRuntime.InvokeVoidAsync(&quot;firebaseSetup&quot;); // This doesn't work.
      }
  }
  
  </code></pre>
  <p>I have also tried writing the setup code directly using <code>import</code> instead of <code>&lt;script/&gt;</code> but it doesn't also seem to work.</p>
  <p>Please also note that my Blazor is configured to work with ES5 - could this be the reason?</p>
  <p>Where did I get this wrong? Cheers in advance.</p>