I'm trying to make a static pwa with next.js and tailwind.
Steps
- Use
create-next-pwa:
npx create-next-pwa pwa-test --tailwind
- Install
gh-pages dependency and update package.json
"scripts": {
"dev": "next dev",
"build": "next build && next export",
"start": "next start",
"format": "prettier --write \"./**/*.{js,json}\"",
"predeploy": "npm run build",
"deploy": "gh-pages -d out -t true"
},
- Update
next.config.js
const withPWA = require('next-pwa');
module.exports = withPWA({
basePath: '/temp',
pwa: {
dest: 'public',
register: true,
skipWaiting: true
}
});
- Run deploy script (you need to setup the remote repo)
npm run deploy
In development mode, the pwa is instalable and works fine.
But when I run next export and add the static site to Github pages, I always get this error:
No matching service worker detected. You may need to reload the page, or check that the scope of the service worker for the current page encloses the scope and start URL from the manifest.

I'm trying to make a static pwa with
next.jsand tailwind.Steps
create-next-pwa:gh-pagesdependency and updatepackage.jsonnext.config.jsnpm run deployIn development mode, the pwa is instalable and works fine.
But when I run
next exportand add the static site to Github pages, I always get this error:No matching service worker detected. You may need to reload the page, or check that the scope of the service worker for the current page encloses the scope and start URL from the manifest.