next-offline icon indicating copy to clipboard operation
next-offline copied to clipboard

How append push notification separate file to service worker?

Open hmz22 opened this issue 5 years ago • 1 comments

Hi dears. How can append separate file service worker with push notification code in workboxOpt, next.config.js when build. please please.

hmz22 avatar Feb 26 '20 15:02 hmz22

i solved this. my next.config.js:

const path = require("path");
const nextOffline = require("next-offline");

module.exports = nextOffline({
  workboxOpts: {
    importScripts: ["./sw.js"],
    mode: "production",
    swDest: path.join(__dirname, "public/service-worker.js")
  }
});

and i create sw.js in public folder

hmz22 avatar Feb 27 '20 08:02 hmz22