vb-pwa
Injects a workbox pre-cache manifest of PWA-enabled web applications into the service worker script. (See the Chrome developer's workbox API doc for details.)
Manifest entries:
- application assets (
build/processed|optimized/webApps/<appId>/**) services/catalog.json(this is created during application deployment. It is not generated by the build)- JET dependencies
 - JET persistence toolkit dependencies
 - Visual Runtime dependencies
 - Telemetry
 - Workbox dependencies
 - Imported stylesheets and their dependencies (fonts, images)
 
User may customize the behavior by adding a custom workbox config file into application sources root. The format of the config can be either a JSON file or JavaScript module:
vb-workbox-config.jsonvb-workbox-config.js
There are two options when using a JavaScript module. The module can either export an object as the config, or it can expose a function that returns a config object.
In the case of exporting an object, the following context is passed into it as an argument and can be used to generate the config object:
{
  sources: {
    root, // path to the root of GIT sources
    application, // path to the web application in GIT sources
  },
  builtAssets: {
    root, // path to root of the build application assets (build/processed|optimized)
    application, // path to application built assets build/processed|optimized/webApps/foo
  },
  jetUrl, // JET URL
  visualBuilderUrl, // VB URL
}The following example shows how to override the workbox config generated by the build, so the pre-cache manifest is injected into a custom file (precacheManifest.json). Please note the file has to exist in the sources. The custom config also adds a custom manifest entry for JET's oj-redwood-min.css stylesheet.
               
Example of custom workbox config
module.exports = (ctx) => {
  return {
    "swSrc": `${ctx.sources.root}/precacheManifest.js`,
    "swDest": `${ctx.builtAssets.application}/precacheManifest.js`,
    "additionalManifestEntries": [
      {
        "url": `${ctx.jetUrl}/default/css/redwood/oj-redwood-min.css`,
        "revision": null
      }
    ]
  }
}The complete list of workbox configuration options is here: https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-build
Details
| Detail | Description | 
|---|---|
| subtasks | n/a | 
| multitasks | n/a | 
| hooks | n/a | 
| input | build/processed|optimized | 
                        
| output | build/processed|optimized | 
                        
Build Options
| Name | Mandatory | Default Value | Description | 
|---|---|---|---|
| target | n/a | build | Name of build directory | 
| git-sources | n/a | check | Location of sources of the visual application |