old_contents: import swPrecache from 'sw-precache';
  import { resolve } from 'path';
  import fs from 'fs';
  import uglifyJs from 'uglify-js';
  import webpackConfig from './webpack.config.prod';
  import pkg from './package.json';
  
  const publicDir = webpackConfig.output.path;
  
  swPrecache.generate({
    cacheId: pkg.name,
    dontCacheBustUrlsMatching: /./,
    dynamicUrlToDependencies: {
      '/': [resolve(__dirname, 'views', 'index.ejs')]
    },
    staticFileGlobs: [
      `${publicDir}/bundle.*.{js,css}`,
      `${publicDir}/vendor.*.{js,css}`
    ],
    navigateFallback: '/',
    navigateFallbackWhitelist: [
      /^\/posts\//,
      /^\/about/
    ],
    stripPrefix: publicDir,
    runtimeCaching: [{
      urlPattern: /api/,
      handler: 'networkFirst'
    }]
  }, (error, serviceWorkerString) => {
    if (error) {
      return console.log(error);
    }
    fs.writeFile(`${publicDir}/sw.js`, uglifyJs.minify(serviceWorkerString).code, (err) => {
      if (err) {
        return console.log(err);
      }
    });
  });
  
new_contents: import swPrecache from 'sw-precache';
  import { resolve } from 'path';
  import fs from 'fs';
  import uglifyJs from 'uglify-js';
  import webpackConfig from './webpack.config.prod';
  import pkg from './package.json';
  
  const publicDir = webpackConfig.output.path;
  
  swPrecache.generate({
    cacheId: pkg.name,
    dontCacheBustUrlsMatching: /./,
    dynamicUrlToDependencies: {
      '/': [resolve(__dirname, 'views', 'index.ejs')]
    },
    staticFileGlobs: [
      `${publicDir}/bundle.*.{js,css}`,
      `${publicDir}/vendor.*.{js,css}`
    ],
    navigateFallback: '/',
    navigateFallbackWhitelist: [
      /^\/posts\//,
      /^\/about/
    ],
    stripPrefix: publicDir,
    runtimeCaching: [{
      urlPattern: /api/,
      handler: 'networkFirst'
    }]
  }).then((serviceWorkerString) => {
    fs.writeFile(`${publicDir}/sw.js`, uglifyJs.minify(serviceWorkerString).code, (err) => {
      if (err) {
        return console.log(err);
      }
    });
  });
  
subject: Update precache