Configuring the Service Worker
In the previous section, we added the service worker configuration file, src/ngsw-config.json
, to our project, but we have not configured anything yet.
In this section, we will add two types of configuration, asset groups and data groups. We will use a fairly straightforward configuration for our service worker. Please refer to the service worker configuration page for a detailed description of the configuration options in ngsw-config.json
.
Exercise 47: Configuring Asset Groups
In this exercise, we will append two items to the asset groups configuration. In the asset groups configuration, we will specify how we want our service worker to handle the assets of the application.
When we talk about assets, we think of stylesheets, images, and external JS files. The first asset group caches the data that comes from the domains that we use to fetch our CSS and the fonts included in that CSS. The second asset group caches the static data from the...