These are some common options, and not all are required. You can add the GenerateSW plugin to your webpack config like so: // Inside of :Ĭonst = require ( 'workbox-webpack-plugin' ) You want the easiest path to adding a service worker to your site.You would like to use your service worker with other platform features (e.g.You need to customize routing and strategies.You want more control over your service worker.The InjectManifest plugin will generate a list of URLs to precache and add that precache manifest to an existing service worker file. You want to import additional scripts, or add additional logic for custom caching strategies.You want to use other Service Worker features (i.e.The GenerateSW plugin will create a service worker file for you and add it to the webpack asset pipeline. The answers to the following questions can help you choose the right plugin and configuration to use. The plugins are implemented as two classes in the workbox-webpack-plugin module, named GenerateSW and InjectManifest. Workbox provides two webpack plugins: one that generates a complete service worker for you and one that generates a list of assets to precache that is injected into a service worker file. Review the API reference for workbox-webpack-plugin.
0 Comments
Leave a Reply. |