Closed elVengador closed 3 months ago
after install next-pwa and setup my next.config.js, Im running my aplication and there is not registered my service worker on my browser, I checked the path
next-pwa
next
I setup my next.config.js
/** @type {import('next').NextConfig} */ const nextConfig = {}; import nextPWA from 'next-pwa' const withPWA = nextPWA({ dest: 'public' register: true, }) export default withPWA(nextConfig)
then run my application and check my browser
my service worker should be registered automatically
there is no registered service worker:
but ther is the sw.js in the path:
I solved adding a Script in my Layout file from NextJs to call sw.js and that register my service worker
Script
sw.js
Can you give me an example script? I'm facing this issue too @elVengador
Summary
after install next-pwa and setup my next.config.js, Im running my aplication and there is not registered my service worker on my browser, I checked the path
Versions
next-pwa
: ^5.6.0next
: 14.1.2How To Reproduce
I setup my next.config.js
then run my application and check my browser
Expected Behaviors
my service worker should be registered automatically
Screenshots
there is no registered service worker:
but ther is the sw.js in the path: