PWA not working in production
See original GitHub issueWhat version of Next.js are you using?
12.0.1
What version of Node.js are you using?
14.17.4
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
Vercel
Describe the Bug
I implemented PWA using next-pwa
in my application, and went through all the necessary steps. ( creating service worker, next-config file, etc ). Everything looks fine in development - “Install app” option pops up . But in production it just seems to disappear, and not even shows the install option
Expected Behavior
PWA pop-up should both appear in development as well as in production.
To Reproduce
- Install
next-pwa
- Generate manifest ( using Simicart ).
- Creating
_document.js
and adding the necessary links.
import Document, { Html, Head, Main, NextScript } from "next/document";
class MyDocument extends Document {
render() {
return (
<Html>
<Head>
<link rel="manifest" href="/manifest.json" />
<link rel="apple-touch-icon" href="/icon.png"></link>
<meta name="theme-color" content="#fff" />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;
- Configure next-config file
const withPWA = require("next-pwa");
module.exports = withPWA({
pwa: {
dest: "public",
register: true,
skipWaiting: true,
},
});
- Add following to
.gitginore
# PWA files
**/public/sw.js
**/public/workbox-*.js
**/public/worker-*.js
**/public/sw.js.map
**/public/workbox-*.js.map
**/public/worker-*.js.map
Also followed according to Nextjs pwa example
For more details visit this repo
Screenshots from Chrome dev tools -
Production link - https://adaalat.vercel.app
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:22 (3 by maintainers)
Top Results From Across the Web
Next-Pwa not working on production server such as Nginx
It is working on the development on local dev server but when I deploy to production like DigitalOcean with nginx it's not working...
Read more >How to build and deploy a PWA with Next.js - Bird Eats Bug
This command builds the application for production usage. npm run build. Next we run npm run start to start our Next.js app in...
Read more >How To Deploy a PWA Demo Server in Production Mode
This article describes how to deploy an Intershop Progressive Web Application (PWA) for a demo server in production mode.
Read more >How to Build a Progressive Web App (PWA) with React
js , you should be able to see it running in the Application tab. Inside that tab, on the left side you should...
Read more >next-pwa - npm
js . Though next-pwa automatically generate the worker box development build during development (by running next ) and worker box production ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Working on this.
This config saves me
https://github.com/shadowwalker/next-pwa/issues/295#issuecomment-972302942