How to turn a Next.js app into a PWA using next-pwa plugin:
Install
next-pwa
yarn add next-pwa
Update
next.config.js
const withPWA = require('next-pwa')({ dest: 'public' }) // ... module.exports = withPWA(nextConfig)
Create a
.webmanifest
file and place it in thepublic
directoryAdd a
<link>
tag to the<head>
ofpages/_document.js
<link rel="manifest" href="/manifest.json">