Skip to content

Latest commit

 

History

History
 
 

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Examples

(not-very) minimal example using SWPrecacheWebpackPlugin in a react / redux project.

Getting Started

Install npm packages

$ npm install

Start the server

$ npm start

Open localhost:3000 in your browser to see the example project.

The service worker is registered in the register-service-worker.ejs template

The SWPrecacheWebpackPlugin is in the plugins of the webpack.config.js file

Production and Local Configurations

Although this example only has one webpack.config.js file, I highly suggest you separate your production and local configurations into separate files that import common configurations from a single base config file. You will only need SWPrecacheWebpackPlugin in production and it will get annoying to have all this caching while trying to develop. Here's an example of the local / production separation.