razzle-plugin-serviceworker
v1.0.3
Published
A serviceworker for Razzle using offline-plugin.
Downloads
49
Maintainers
Readme
razzle-plugin-serviceworker
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
}
}],
};