<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Josh Crowther on Medium]]></title>
        <description><![CDATA[Stories by Josh Crowther on Medium]]></description>
        <link>https://medium.com/@jshcrowthe?source=rss-6800a3488951------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6AO2jiTWyRJeNEpal8RRJg.jpeg</url>
            <title>Stories by Josh Crowther on Medium</title>
            <link>https://medium.com/@jshcrowthe?source=rss-6800a3488951------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 04:07:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jshcrowthe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lazy Loading with Firebase 4.1.x]]></title>
            <link>https://medium.com/@jshcrowthe/lazy-loading-with-firebase-4-1-x-c51f67a51f56?source=rss-6800a3488951------2</link>
            <guid isPermaLink="false">https://medium.com/p/c51f67a51f56</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Josh Crowther]]></dc:creator>
            <pubDate>Mon, 05 Jun 2017 18:01:01 GMT</pubDate>
            <atom:updated>2017-06-06T17:51:00.017Z</atom:updated>
            <content:encoded><![CDATA[<p>Last week the Firebase team released version 4.1.0 of the JS SDK. This minor version introduces lazy loading of the Firebase SDK.</p><p>…Let that sink in</p><p>In the words of David East:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*2hLc91NDYS4xbfJ7_WnVRQ.png" /><figcaption><a href="https://twitter.com/_davideast/status/869712176180637696">https://twitter.com/_davideast/status/869712176180637696</a></figcaption></figure><p>The Firebase JS SDK provides a lot of functionality (Authentication, Realtime Database, Storage, FCM), but providing a simple interface to these powerful APIs comes at a cost, in this specific context, a byte cost (107KB gzip/min to be precise).</p><p>Being able to load that 107KB, on an as needed basis, enables developers to build performant experiences, while still getting the benefits of Firebase. To illustrate this, using WebPageTest, I took some comparisons of a simple lazy loading implementation using the <a href="https://github.com/firebase/friendlychat/tree/master/web">Firebase Web Codelab</a>.</p><p><em>Check out the comparison for yourself </em><a href="https://www.webpagetest.org/video/compare.php?tests=170602_8T_bd0f3c1838b7f1307d1a3cfaf27c5aea,170602_C7_7f6496bd3239ebaeea37761bc8581530"><em>here</em></a><em>.</em></p><p>In this test (testing an emerging market 3g connection), the lazy loaded implementation consistently loads almost a second faster (~0.9 seconds) in <strong>every measured metric</strong>.</p><p><em>Web page test even made a nice video: </em><a href="https://www.webpagetest.org/results/video/17/06/02/6f8dde4cdb789bba61dd16bae29ba553511c29ac/video.mp4"><em>https://www.webpagetest.org/results/video/17/06/02/6f8dde4cdb789bba61dd16bae29ba553511c29ac/video.mp4</em></a></p><h3>How Do I Lazy Load Firebase?</h3><p>If you’ve ever been to the Firebase console, you’ve probably seen the following box before:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*UetmzC2aWd6bqULBIfE5ow.png" /><figcaption>“Add Firebase to your web app” prompt in the Firebase console</figcaption></figure><p>This prompt only shows 1 of the 6 javascript files we push to our CDN (i.e. <a href="https://www.gstatic.com/firebasejs/4.1.1/firebase.js">https://www.gstatic.com/firebasejs/4.1.1/firebase.js</a>). The other 5 files allow you to consume the SDK far more granularly:</p><ul><li><a href="https://www.gstatic.com/firebasejs/4.1.1/firebase.js">https://www.gstatic.com/firebasejs/4.1.1/firebase-app.js</a></li><li><a href="https://www.gstatic.com/firebasejs/4.1.1/firebase-database.js">https://www.gstatic.com/firebasejs/4.1.1/firebase-database.js</a></li><li><a href="https://www.gstatic.com/firebasejs/4.1.1/firebase-auth.js">https://www.gstatic.com/firebasejs/4.1.1/firebase-auth.js</a></li><li><a href="https://www.gstatic.com/firebasejs/4.1.1/firebase-storage.js">https://www.gstatic.com/firebasejs/4.1.1/firebase-storage.js</a></li><li><a href="https://www.gstatic.com/firebasejs/4.1.1/firebase-messaging.js">https://www.gstatic.com/firebasejs/4.1.1/firebase-messaging.js</a></li></ul><p>firebase-app.js is the only <strong>required</strong> file. It defines the firebase namespace, and provides the hooks for the rest of the components. You can then pick and choose which components you load (i.e. database, auth, storage, messaging) and can load them on demand as needed. Giving developers complete control.</p><p><em>Take a look at the following JSBin to see this in action:</em></p><p><a href="http://jshcrowthe.jsbin.com/zozuqeh/35/edit?js,console">JS Bin</a></p><p>You can take a look at the source code for the Firebase JS SDK on Github: <a href="https://github.com/firebase/firebase-js-sdk">https://github.com/firebase/firebase-js-sdk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c51f67a51f56" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>