1

The repo is open source

// next.config.js
const withPWA = require("next-pwa");

module.exports = withPWA({
  pwa: {
    dest: "public",
    sw: '/sw.js'
  },
});

_document.js

_app.js

Live

https://time-stamp.vercel.app

I have checked weather the PWA is working on the above URL or not using

function isPwa() {
    return ["fullscreen", "standalone", "minimal-ui"].some(
        (displayMode) => window.matchMedia('(display-mode: ' + displayMode + ')').matches
    );
}
isPwa() // false
// https://stackoverflow.com/questions/41742390/javascript-to-check-if-pwa-or-mobile-web
Rahul
  • 1,858
  • 1
  • 12
  • 33

2 Answers2

0

You may want to use the next-pwa package like this :

const withPWA = require("next-pwa");
const runtimeCaching = require("next-pwa/cache");

module.exports = withPWA({
  pwa: {
    dest: "public",
    runtimeCaching,
    disable: process.env.NODE_ENV === "development",
  }
});

Mehdi Faraji
  • 2,574
  • 8
  • 28
  • 76
0

updating the next-pwa and following the steps in https://stackoverflow.com/questions/73585089/build-error-when-compiling-next-js-app-using-next-pwa worked for me

  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34019981) – Anonymous Mar 16 '23 at 10:30