Skip to content

Latest commit

 

History

History

next-plugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@next-with-offline/next-plugin

size dependencies build downloads license

Next.js plugin for generating a Workbox. Intended to be used alongside @next-with-offline/react-hook and @next-with-offline/service-worker. Read the top level documentation for more information about usage.

Install

yarn add @next-with-offline/next-plugin

Basic Usage

Update or create next.config.js with

const withOffline = require("@next-with-offline/next-plugin");

module.exports = withOffline({
  offline: {
    path: "/offline",
  },
  workbox: {
    dest: "public",
    swDest: "sw.js",
    swSrc: "worker.js",
    // .
    // ..
    // ... other workbox-webpack-plugin.InjectManifest options
  },
  // .
  // ..
  // ... other Next.js config
});

Add public/sw.js and public/sw.js.map to your .gitignore

public/sw.js
public/sw.js.map