1.0.3 • Published 4 years ago

@voyo/sw-auto-manager v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago
webpack plugin
  • Auto deploy Service Worker

  • Auto deploy PWA

Install

npm install @voyo/sw-auto-manager

Example

const {VoyoSwAutoManager} =require("@voyo/sw-auto-manager");
/* 
* webpack config
*
*/
plugins:[
    new VoyoSwAutoManager({
      //service worker config
     swOpts:{
        useDebugger:true,
        scopeRule:/(\/image\/|\/fonts\/|\/css\/|favicon.ico|index.html|\/js\/|voyo-manifest.json)/,
        dynamicCacheRules:[
          /ztwx\.woff/
        ]
    },
    //pwa config
     pwaOpts:{
      enabled:true,
      manifestConfig:{
        name:title,
        icons:[
            {src:"image/logo.png",sizes:"400x400",type:"image/png"}
        ],
        description:"description",
        display:"standalone",
        start_url:"/index.html",
        short_name:"shortName",
        theme_color:"black"
      }
    }
  })
]

configuration

swOpts

service worker config

keytypedescription
version?: string | "auto"specify or automatic
updateInterval?: numberTime between update to the worker file
useDebugger?: boolean
pluginName?: string
swFilePath?: string
cachePagesFilePath?: string
cacheBrand?: string
scopeRule?: RegExp
dynamicCacheRules?: Array<RegExp| string>|string|RegExp

pwaOpts

pwa config |key|type| |--|--| |enabled|: boolean| |manifestConfig|: PWAManifestConfig| |config|: PWAConfig|

PWAConfig |key|type|description| |--|--|--| |useDebugger?|boolean| |manifestPath?|string| |customPrompt?|boolean|The plugin will automatically configure the PWA popover. Disable this if you want to write it manually| |pwaPromptPath?|string|