Skip to content

Workbox, React, Typescript (configuration?) #2525

Answered by openscript
viinxent asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @viinxent

Interesting post! I'm exactly at the same point. Unfortunately I haven't found any example.

An integration of the generateSW flow (https://developers.google.com/web/tools/workbox/modules/workbox-cli) is simple:

  1. Add workbox-cli to your development dependencies
  2. Create a workbox-config.js by hand or with the wizard. Mine looks currently like this:
module.exports = {
  "globDirectory": "build/",
  "globPatterns": [
    "**/*.{js,json,css,png,html,txt}"
  ],
  "swDest": "build/sw.js",
  runtimeCaching: [
    {
      urlPattern: /^https:\/\/fonts\.googleapis\.com/,
      handler: 'StaleWhileRevalidate',
      options: {
        cacheName: 'google-fonts-stylesheets'
      }
    },…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
3 replies
@viinxent
Comment options

@openscript
Comment options

@YuukiToriyama
Comment options

Answer selected by viinxent
Comment options

You must be logged in to vote
4 replies
@mwmcode
Comment options

@openscript
Comment options

@mwmcode
Comment options

@mwmcode
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants