Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 1.58 KB

README.md

File metadata and controls

64 lines (49 loc) · 1.58 KB

razzle-plugin-serviceworker

Build Status Coverage Status npm dependencies Status devDependencies Status

A serviceworker for Razzle using offline-plugin.

Installation

Node.js

$ npm install razzle-plugin-serviceworker --save-dev
$ npm install offline-plugin --save

Configuration

Edit or create razzle.config.js in your project root.

// razzle.config.js
module.exports = {
  plugins: ['serviceworker'],
};

Add serviceWorker to client

Add to src/client.js

import * as OfflinePluginRuntime from "offline-plugin/runtime";
OfflinePluginRuntime.install();

Adding server side webpack plugin options

// razzle.config.js
module.exports = {
  plugins: [{
      name:'serviceworker',
      options: {
          autoUpdate: true
      }
  }],
};

License

ISC