title: Initialize Firebase references in two separate files in the new API
body: <p>I have upgraded to the new API and don't know how to initialize Firebase references in two separate files:</p>
  
  <pre><code>    /* CASE 1 */
      // 1st file
      var config = {/* ...  */};
      firebase.initializeApp(config);
      var rootRef = firebase.database().ref();
  
      // 2nd file - initialize again
      var config = {/* ...  */};
      firebase.initializeApp(config);
      var rootRef = firebase.database().ref();
  </code></pre>
  
  <blockquote>
    <p>RESULT: bundle.js:535 Uncaught Error: Firebase App named '[DEFAULT]' already exists.</p>
  </blockquote>
  
  <pre><code>    /* CASE 2 */
      // 1st file
      var config = {/* ...  */};
      firebase.initializeApp(config);
      var rootRef = firebase.database().ref();
  
      // 2nd file - don't initialize
      var rootRef = firebase.database().ref();
  </code></pre>
  
  <blockquote>
    <p>RESULT: bundle.js:529 Uncaught Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp().</p>
  </blockquote>
  
  <p>Before the new API I just called</p>
  
  <pre><code>var myFirebaseRef = new Firebase("https://&lt;YOUR-FIREBASE-APP&gt;.firebaseio.com/");
  </code></pre>
  
  <p>in each file, and it worked okay.</p>