Can't pass Chrome Lighthouse PWA test even when service work is registered

Viewed 710

I'm building a progressive web app bundled by webpack which uses service workers generated by workbox. When I ran the Chrome Lighthouse on the web app, however, it complains that:

  • Current page does not respond with a 200 when offline
  • start_url does not respond with a 200 when offline
  • Does not register a service worker that controls page and start_url

More disturbing is that even though this web app works as a PWA on my Windows desktop, it doesn't work on Android Chrome as the "Add to Home Screen" option didn't pop up.

Link to web app: https://alienkevin.github.io/try-elm-rust-pwa/

Link to full repo: https://github.com/AlienKevin/try-elm-rust-pwa/tree/master

Here's the log message proving that the service worker is registered: service worker log

Here's my webpack.config.js:

const CopyWebpackPlugin = require("copy-webpack-plugin");
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const workboxPlugin = require('workbox-webpack-plugin');
const path = require('path');

module.exports = {
  entry: "./bootstrap.js",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "bootstrap.js",
  },
  mode: "development",
  plugins: [
    new CleanWebpackPlugin(),
    new CopyWebpackPlugin(['index.html', '*.ico', '*.png', 'manifest.json']),
    new workboxPlugin.GenerateSW({
      swDest: 'sw.js',
      clientsClaim: true,
      skipWaiting: true,
    }),
  ],
};

Here's my manifest.json:

{
  "short_name": "try-elm-rust-2",
  "name": "try-elm-rust-2",
  "icons": [
    {
      "src": "./android-chrome-192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "./android-chrome-512x512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ],
  "start_url": "./index.html",
  "display": "standalone",
  "theme_color": "#f74c00",
  "background_color": "#ffffff"
}

I'm aware of a similar issue #6342 on lighthouse but the sample they provided didn't help me.

0 Answers
Related