1.0.0 • Published 3 years ago

@gdexporter/plugin-offline v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

plugin-offline

Generates a service worker for caching using workbox, to allow playing the game offline.

Options

{
  workerFileName: "sw.js",
  sourceWorker: "./myWorker.js",
  workboxOptions: {
    runtimeCache: [
      {
        urlPattern: "*",
        handler: "NetworkFirst",
      },
    ],
  },
}

workerFileName = "sw.js"

The filename of the output service worker.

sourceWorker = undefined

If a string is passed as sourceWorker, the plugin will use injectManifest instead of generateSW. You can find the differences on the official workbox docs.

workboxOptions = {runtimeCaching: [{ urlPattern: "*", handler: "NetworkFirst" }], globPatterns: ["**/*"]}

The options passed to workbox when building. You can find them on the official workbox docs. Be aware that the available options may vary depending on if you use injectManifest or generateSW (see the sourceWorker option).