10.0.1 • Published 7 years ago

@poi/plugin-sw-precache v10.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

plugin-sw-precache

Integrated sw-precache-webpack-plugin into production configuration to add Progressive Web App support.

This is basically extracted from create-react-app but as a Poi plugin.

A live example can be found at: https://poi-sw-precache.surge.sh, you can enable offline mode in chrome devtools to check if it works for you.

Install

yarn add @poi/plugin-sw-precache

Usage

Add the plugin to your config file:

module.exports = {
  plugins: [
    require('@poi/plugin-sw-precache')()
  ]
}

Then register service worker in your entry file:

import register from '@poi/plugin-sw-precache/register-service-worker'

register()

To have a full progressive web app support, you need to put your PWA metadata file at ./static/manifest.json, here's an example:

{
  "short_name": "Poi App",
  "name": "My Sample App",
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "64x64 32x32 24x24 16x16",
      "type": "image/x-icon"
    }
  ],
  "start_url": "./index.html",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff"
}

And of course favicon.ico is also required in this example.

Service worker events

You can use your own version of ./register-service-worker.js to handle service worker events, like what to perform when new updates of your app are available, by default it simply logs a message and users to to refresh browser to see updated version.

License

MIT © EGOIST

10.0.1

7 years ago

10.0.0

7 years ago

10.0.0-rc.1

7 years ago

10.0.0-rc.0

7 years ago

10.0.0-beta.10

7 years ago

10.0.0-beta.9

7 years ago

10.0.0-beta.8

7 years ago

10.0.0-beta.7

7 years ago

10.0.0-beta.2

7 years ago

10.0.0-beta.1.0

7 years ago