@next-with-offline/next-plugin
v4.0.1
Published
Next.js plugin for generating a service worker.
Downloads
8
Maintainers
Readme
@next-with-offline/next-plugin
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