Ship PWA Guided by Lighthouse
Nowadays, PWA is so hyped. All the cool kids are implementing PWA, or on the way to implement it. It’s like a magic box, they said, what contains ultimate happiness for users. Wow it sounds awesome, right? How is it possible that I could miss this opportunity to stay as a member of the cool kids club?
What is actually PWA?
According to Google, Progressive Web Apps are user experiences that have the reach of the web, and are :
- Reliable: Load instantly and never show the downasaur, even in uncertain network conditions.
- Fast: Respond quickly to user interactions with silky smooth animations and no janky scrolling.
- Engaging: Feel like a natural app on the device, with an immersive user experience.
Personally, I prefer another alternative version because it uses one word to represent PWA: F.I.R.E 🔥 Fast, Integrated, Reliable and Engaging. :
Many people are confused by the fancy term of PWA, like this: Google’s continued use of the term “quality” in describing things leaves me with a ton of confusion… 
To be honest, PWA is not a new technology at all. It’s a new web app quality standard for web experiences .
How to get my app on F.I.R.E.?
Are you sold by the idea of PWA? I’ll buy it. Because I would do whatever I could to improve the user experience. So, I decided to optimize my blog site for reaching PWA standard.
Step 1: Run a performance audit
Lighthouse is a must-have tool to audit web app performance. Lighthouse is already integrated in the recent versions of Chrome and Chromium, as a part of DevTools, which makes it super convenient to use: Inspect -> Audits -> Perform an audit…
Step 2: Read audit report carefully
After running an audit in Lighthouse, it will provide a detailed report. First, it shows the overall scores:
I’m not surprised by this result, not at all. These numbers are making people feel good when they have greens. Besides that, I would suggest to ignore them.
When continuing reading the report, I find the interesting parts: failed audits. It’s a nicely organized To-Do list, especially the Learn more links which open documents to explain why the audit is important and how to pass the audit.
Step 3: Get hands dirty
It’s time to handle all failed cases one by one. Most of them are rather easy to solve by following “Learn more” tutorials. Only “Does not register a Service Worker” and “Does not respond with a 200 when offline” are relatively tough. I’d like to share some tips, which come from my Aha moments.
A working service worker has 4 essential parts:
- manifest.json: It’s a json file located in / web app root directory:
- Link manifest.json in index.html:
<link rel="manifest" href="/manifest.json">
- Service worker js: It must be created in web app root directory, alongside with manifest.json. Here is an example of the service worker called sw.js:
My app is on 🔥!
Once the dirty jobs are well done, it’s time to run another performance audit. Although I know all score numbers are meaningless without contexts, it still feels damn awesome when I see all greens, right?
Surprisingly, Firefox now starts to support PWA as well:
Wow Firefox 59 supports PWA “add to home screen”. Nice 🤭 pic.twitter.com/HpSdKQX7fi
— Kevin ˗ˏˋ💡ˎˊ (@KevCui) December 3, 2017
I have to admit that it’s not hard to pass Lighthouse audit checks. However, I must keep in mind that it’s just one step of improving web app performance towards the goal of “better user experience”. Many steps ahead I still need to move on.
What’s your opinion about PWA? Would you like to ship your app guided by Lighthouse? And join the cool kids club?
Originally published at krazycavin.github.io on December 3, 2017.