razzle-plugin-offline

0.0.1-alpha.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i razzle-plugin-offline

Weekly Downloads

0

Version

0.0.1-alpha.1

License

MIT

Unpacked Size

7.25 kB

Total Files

6

Last publish

Collaborators

  • strax77