0.0.1-alpha.1 • Published 6 years ago

razzle-plugin-offline v0.0.1-alpha.1

Weekly downloads
15
License
MIT
Repository
-
Last release
6 years ago

Razzle Plugin Offline

Adds a NekR/offline-plugin serviceworker to your Razzle implementation.

Installation

yarn add razzle-plugin-offline

Configuration

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

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

Add serviceWorker to client

At the bottom of your src/client.js add

if (process.env.NODE_ENV === 'production') {
  require('razzle-plugin-offline/lib/serviceWorker')();
}

Adding client side serviceWorker options

Options are optional and should be based on NekR/offline-plugin

if (process.env.NODE_ENV === 'production') {
  const options = {
      // my options
  };
  require('razzle-plugin-offline/lib/serviceWorker')(options);
}

Adding server side webpack plugin options

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

License

MIT

0.0.1-alpha.1

6 years ago

0.0.1-alpha

6 years ago